Ensure ciphertext is always modified in unit test.

This commit is contained in:
akwizgran
2014-04-11 13:00:22 +01:00
parent 3dab4543e6
commit 39f79b55ef

View File

@@ -33,8 +33,7 @@ public class PasswordBasedKdfTest extends BriarTestCase {
byte[] ciphertext = crypto.encryptWithPassword(input, password);
// Modify the ciphertext
int position = random.nextInt(ciphertext.length);
int value = random.nextInt(256);
ciphertext[position] = (byte) value;
ciphertext[position] = (byte) (ciphertext[position] ^ 0xFF);
byte[] output = crypto.decryptWithPassword(ciphertext, password);
assertNull(output);
}