Use Ed25519 for signatures.

This commit is contained in:
akwizgran
2018-02-01 16:56:50 +00:00
parent 7a1247e325
commit 6bf2cb69c5
13 changed files with 104 additions and 271 deletions

View File

@@ -15,6 +15,7 @@ import org.briarproject.briar.client.BdfQueueMessageValidator;
import javax.annotation.concurrent.Immutable;
import static org.briarproject.bramble.api.crypto.CryptoConstants.MAX_AGREEMENT_PUBLIC_KEY_BYTES;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_SIGNATURE_LENGTH;
@@ -133,7 +134,7 @@ class IntroductionValidator extends BdfQueueMessageValidator {
// parse ephemeral public key
pubkey = message.getRaw(4);
checkLength(pubkey, 1, MAX_PUBLIC_KEY_LENGTH);
checkLength(pubkey, 1, MAX_AGREEMENT_PUBLIC_KEY_BYTES);
// parse transport properties
tp = message.getDictionary(5);

View File

@@ -36,7 +36,7 @@ import org.junit.Test;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
import static org.briarproject.bramble.api.crypto.CryptoConstants.MAX_AGREEMENT_PUBLIC_KEY_BYTES;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_SIGNATURE_LENGTH;
import static org.briarproject.bramble.api.sync.SyncConstants.MESSAGE_HEADER_LENGTH;
import static org.briarproject.bramble.test.TestUtils.getAuthor;
@@ -215,7 +215,7 @@ public class IntroduceeManagerTest extends BriarTestCase {
// turn request message into a response
msg.put(ACCEPT, true);
msg.put(TIME, time);
msg.put(E_PUBLIC_KEY, getRandomBytes(MAX_PUBLIC_KEY_LENGTH));
msg.put(E_PUBLIC_KEY, getRandomBytes(MAX_AGREEMENT_PUBLIC_KEY_BYTES));
msg.put(TRANSPORT, new BdfDictionary());
context.checking(new Expectations() {{
@@ -308,7 +308,7 @@ public class IntroduceeManagerTest extends BriarTestCase {
byte[] publicKeyBytes = introducee2.getAuthor().getPublicKey();
BdfDictionary tp = BdfDictionary.of(new BdfEntry("fake", "fake"));
byte[] ePublicKeyBytes = getRandomBytes(MAX_PUBLIC_KEY_LENGTH);
byte[] ePublicKeyBytes = getRandomBytes(MAX_AGREEMENT_PUBLIC_KEY_BYTES);
byte[] mac = getRandomBytes(MAC_LENGTH);
SecretKey macKey = getSecretKey();

View File

@@ -730,7 +730,7 @@ public class IntroductionIntegrationTest
@Test
public void testModifiedEphemeralPublicKey() throws Exception {
testModifiedResponse(response -> {
KeyPair keyPair = crypto.generateSignatureKeyPair();
KeyPair keyPair = crypto.generateAgreementKeyPair();
response.put(E_PUBLIC_KEY, keyPair.getPublic().getEncoded());
return true;
});

View File

@@ -20,6 +20,7 @@ import org.briarproject.briar.test.BriarTestCase;
import org.jmock.Mockery;
import org.junit.Test;
import static org.briarproject.bramble.api.crypto.CryptoConstants.MAX_AGREEMENT_PUBLIC_KEY_BYTES;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_SIGNATURE_LENGTH;
@@ -164,7 +165,7 @@ public class IntroductionValidatorTest extends BriarTestCase {
byte[] groupId = getRandomId();
byte[] sessionId = getRandomId();
long time = clock.currentTimeMillis();
byte[] publicKey = getRandomBytes(MAX_PUBLIC_KEY_LENGTH);
byte[] publicKey = getRandomBytes(MAX_AGREEMENT_PUBLIC_KEY_BYTES);
String transportId =
getRandomString(TransportId.MAX_TRANSPORT_ID_LENGTH);
BdfDictionary tProps = BdfDictionary.of(
@@ -255,7 +256,7 @@ public class IntroductionValidatorTest extends BriarTestCase {
byte[] groupId = getRandomId();
byte[] sessionId = getRandomId();
long time = clock.currentTimeMillis();
byte[] publicKey = getRandomBytes(MAX_PUBLIC_KEY_LENGTH);
byte[] publicKey = getRandomBytes(MAX_AGREEMENT_PUBLIC_KEY_BYTES);
String transportId =
getRandomString(TransportId.MAX_TRANSPORT_ID_LENGTH);
BdfDictionary tProps = BdfDictionary.of(