mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 21:59:54 +01:00
Use static comparison method.
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package org.briarproject.bramble.contact;
|
package org.briarproject.bramble.contact;
|
||||||
|
|
||||||
import org.briarproject.bramble.api.Bytes;
|
|
||||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||||
import org.briarproject.bramble.api.crypto.KeyPair;
|
import org.briarproject.bramble.api.crypto.KeyPair;
|
||||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||||
@@ -12,6 +11,7 @@ import java.security.GeneralSecurityException;
|
|||||||
import javax.annotation.concurrent.Immutable;
|
import javax.annotation.concurrent.Immutable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import static org.briarproject.bramble.api.Bytes.compare;
|
||||||
import static org.briarproject.bramble.contact.HandshakeConstants.ALICE_PROOF_LABEL;
|
import static org.briarproject.bramble.contact.HandshakeConstants.ALICE_PROOF_LABEL;
|
||||||
import static org.briarproject.bramble.contact.HandshakeConstants.BOB_PROOF_LABEL;
|
import static org.briarproject.bramble.contact.HandshakeConstants.BOB_PROOF_LABEL;
|
||||||
import static org.briarproject.bramble.contact.HandshakeConstants.MASTER_KEY_LABEL;
|
import static org.briarproject.bramble.contact.HandshakeConstants.MASTER_KEY_LABEL;
|
||||||
@@ -32,7 +32,7 @@ class HandshakeCryptoImpl implements HandshakeCrypto {
|
|||||||
KeyPair ourStaticKeyPair) {
|
KeyPair ourStaticKeyPair) {
|
||||||
byte[] ours = ourStaticKeyPair.getPublic().getEncoded();
|
byte[] ours = ourStaticKeyPair.getPublic().getEncoded();
|
||||||
byte[] theirs = theirStaticPublicKey.getEncoded();
|
byte[] theirs = theirStaticPublicKey.getEncoded();
|
||||||
return new Bytes(ours).compareTo(new Bytes(theirs)) < 0;
|
return compare(ours, theirs) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user