mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Timestamp isn't needed for deriving root key.
This commit is contained in:
@@ -14,8 +14,8 @@ interface TransportKeyAgreementCrypto {
|
||||
|
||||
KeyPair generateKeyPair();
|
||||
|
||||
SecretKey deriveRootKey(KeyPair localKeyPair, PublicKey remotePublicKey,
|
||||
long timestamp) throws GeneralSecurityException;
|
||||
SecretKey deriveRootKey(KeyPair localKeyPair, PublicKey remotePublicKey)
|
||||
throws GeneralSecurityException;
|
||||
|
||||
PublicKey parsePublicKey(byte[] encoded) throws FormatException;
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ class TransportKeyAgreementCryptoImpl implements TransportKeyAgreementCrypto {
|
||||
|
||||
@Override
|
||||
public SecretKey deriveRootKey(KeyPair localKeyPair,
|
||||
PublicKey remotePublicKey, long timestamp)
|
||||
throws GeneralSecurityException {
|
||||
PublicKey remotePublicKey) throws GeneralSecurityException {
|
||||
byte[] theirPublic = remotePublicKey.getEncoded();
|
||||
byte[] ourPublic = localKeyPair.getPublic().getEncoded();
|
||||
boolean alice = compare(ourPublic, theirPublic) < 0;
|
||||
|
||||
@@ -255,8 +255,7 @@ class TransportKeyAgreementManagerImpl extends BdfIncomingMessageHook
|
||||
long minTimestamp = min(keyMessage.getTimestamp(), m.getTimestamp());
|
||||
SecretKey rootKey;
|
||||
try {
|
||||
rootKey = crypto.deriveRootKey(localKeyPair, remotePublicKey,
|
||||
minTimestamp);
|
||||
rootKey = crypto.deriveRootKey(localKeyPair, remotePublicKey);
|
||||
} catch (GeneralSecurityException e) {
|
||||
return REJECT; // Invalid public key
|
||||
}
|
||||
@@ -281,8 +280,7 @@ class TransportKeyAgreementManagerImpl extends BdfIncomingMessageHook
|
||||
long minTimestamp = min(localTimestamp, m.getTimestamp());
|
||||
SecretKey rootKey;
|
||||
try {
|
||||
rootKey = crypto.deriveRootKey(localKeyPair, remotePublicKey,
|
||||
minTimestamp);
|
||||
rootKey = crypto.deriveRootKey(localKeyPair, remotePublicKey);
|
||||
} catch (GeneralSecurityException e) {
|
||||
return REJECT; // Invalid public key
|
||||
}
|
||||
|
||||
@@ -530,8 +530,7 @@ public class TransportKeyAgreementManagerImplTest extends BrambleMockTestCase {
|
||||
private void expectDeriveAndStoreTransportKeys(Transaction txn)
|
||||
throws Exception {
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(crypto).deriveRootKey(localKeyPair, remotePublicKey,
|
||||
min(localTimestamp, remoteTimestamp));
|
||||
oneOf(crypto).deriveRootKey(localKeyPair, remotePublicKey);
|
||||
will(returnValue(rootKey));
|
||||
oneOf(db).getContact(txn, contact.getId());
|
||||
will(returnValue(contact));
|
||||
|
||||
Reference in New Issue
Block a user