mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 07:09:56 +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);
|
byte[] ciphertext = crypto.encryptWithPassword(input, password);
|
||||||
// Modify the ciphertext
|
// Modify the ciphertext
|
||||||
int position = random.nextInt(ciphertext.length);
|
int position = random.nextInt(ciphertext.length);
|
||||||
int value = random.nextInt(256);
|
ciphertext[position] = (byte) (ciphertext[position] ^ 0xFF);
|
||||||
ciphertext[position] = (byte) value;
|
|
||||||
byte[] output = crypto.decryptWithPassword(ciphertext, password);
|
byte[] output = crypto.decryptWithPassword(ciphertext, password);
|
||||||
assertNull(output);
|
assertNull(output);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user