From fbd63a24a0f1d71056e1ab2bbcbb04990f6eea59 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Sat, 6 Apr 2019 10:33:20 +0200 Subject: [PATCH] ECKeyTest: Simplify testEncryptionIsReversible(). --- core/src/test/java/org/bitcoinj/core/ECKeyTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/org/bitcoinj/core/ECKeyTest.java b/core/src/test/java/org/bitcoinj/core/ECKeyTest.java index 23f376671..717f16b1e 100644 --- a/core/src/test/java/org/bitcoinj/core/ECKeyTest.java +++ b/core/src/test/java/org/bitcoinj/core/ECKeyTest.java @@ -335,13 +335,13 @@ public class ECKeyTest { ECKey encryptedKey = ECKey.fromEncrypted(encryptedPrivateKey, keyCrypter, originalUnencryptedKey.getPubKey()); // The key should be encrypted - assertTrue("Key not encrypted at start", encryptedKey.isEncrypted()); + assertTrue("Key not encrypted at start", encryptedKey.isEncrypted()); // Check that the key can be successfully decrypted back to the original. assertTrue("Key encryption is not reversible but it should be", ECKey.encryptionIsReversible(originalUnencryptedKey, encryptedKey, keyCrypter, keyCrypter.deriveKey(PASSWORD1))); // Check that key encryption is not reversible if a password other than the original is used to generate the AES key. - assertTrue("Key encryption is reversible with wrong password", !ECKey.encryptionIsReversible(originalUnencryptedKey, encryptedKey, keyCrypter, keyCrypter.deriveKey(WRONG_PASSWORD))); + assertFalse("Key encryption is reversible with wrong password", ECKey.encryptionIsReversible(originalUnencryptedKey, encryptedKey, keyCrypter, keyCrypter.deriveKey(WRONG_PASSWORD))); // Change one of the encrypted key bytes (this is to simulate a faulty keyCrypter). // Encryption should not be reversible @@ -351,7 +351,7 @@ public class ECKeyTest { byte[] badEncryptedPrivateKeyBytes = new byte[goodEncryptedPrivateKeyBytes.length]; encryptedPrivateKey = new EncryptedData(encryptedPrivateKey.initialisationVector, badEncryptedPrivateKeyBytes); ECKey badEncryptedKey = ECKey.fromEncrypted(encryptedPrivateKey, keyCrypter, originalUnencryptedKey.getPubKey()); - assertTrue("Key encryption is reversible with faulty encrypted bytes", !ECKey.encryptionIsReversible(originalUnencryptedKey, badEncryptedKey, keyCrypter, keyCrypter.deriveKey(PASSWORD1))); + assertFalse("Key encryption is reversible with faulty encrypted bytes", ECKey.encryptionIsReversible(originalUnencryptedKey, badEncryptedKey, keyCrypter, keyCrypter.deriveKey(PASSWORD1))); } @Test