mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Ensure ciphertext is always modified in unit test.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user