mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Forward secrecy.
Each connection's keys are derived from a secret that is erased after deriving the keys and the secret for the next connection.
This commit is contained in:
@@ -64,7 +64,8 @@ public class FrameReadWriteTest extends TestCase {
|
||||
|
||||
private void testWriteAndRead(boolean initiator) throws Exception {
|
||||
// Create and encrypt the IV
|
||||
byte[] iv = IvEncoder.encodeIv(initiator, transportIndex, connection);
|
||||
byte[] iv = IvEncoder.encodeIv(initiator, transportIndex.getInt(),
|
||||
connection);
|
||||
ivCipher.init(Cipher.ENCRYPT_MODE, ivKey);
|
||||
byte[] encryptedIv = ivCipher.doFinal(iv);
|
||||
assertEquals(IV_LENGTH, encryptedIv.length);
|
||||
@@ -92,7 +93,7 @@ public class FrameReadWriteTest extends TestCase {
|
||||
// Decrypt the IV
|
||||
ivCipher.init(Cipher.DECRYPT_MODE, ivKey);
|
||||
byte[] recoveredIv = ivCipher.doFinal(recoveredEncryptedIv);
|
||||
iv = IvEncoder.encodeIv(initiator, transportIndex, connection);
|
||||
iv = IvEncoder.encodeIv(initiator, transportIndex.getInt(), connection);
|
||||
assertArrayEquals(iv, recoveredIv);
|
||||
// Read the frames back
|
||||
ConnectionDecrypter decrypter = new ConnectionDecrypterImpl(in, iv,
|
||||
|
||||
Reference in New Issue
Block a user