Rename key parser classes.

This commit is contained in:
akwizgran
2019-04-23 17:05:56 +01:00
parent de8a60ea21
commit d2951eb3cd
4 changed files with 12 additions and 6 deletions

View File

@@ -9,8 +9,11 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import java.security.GeneralSecurityException;
import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
class Curve25519KeyParser implements KeyParser {
class AgreementKeyParser implements KeyParser {
@Override
public PublicKey parsePublicKey(byte[] encodedKey)

View File

@@ -86,8 +86,8 @@ class CryptoComponentImpl implements CryptoComponent {
signatureKeyPairGenerator = new KeyPairGenerator();
signatureKeyPairGenerator.initialize(SIGNATURE_KEY_PAIR_BITS,
secureRandom);
agreementKeyParser = new Curve25519KeyParser();
signatureKeyParser = new EdKeyParser();
agreementKeyParser = new AgreementKeyParser();
signatureKeyParser = new SignatureKeyParser();
messageEncrypter = new MessageEncrypter(secureRandom);
}

View File

@@ -9,8 +9,11 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import java.security.GeneralSecurityException;
import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
class EdKeyParser implements KeyParser {
class SignatureKeyParser implements KeyParser {
@Override
public PublicKey parsePublicKey(byte[] encodedKey)

View File

@@ -68,9 +68,9 @@ public class KeyAgreementTest extends BrambleTestCase {
public void testRfc7748TestVector() {
// Private keys need to be clamped because curve25519-java does the
// clamping at key generation time, not multiplication time
byte[] aPriv = Curve25519KeyParser.clamp(fromHexString(ALICE_PRIVATE));
byte[] aPriv = AgreementKeyParser.clamp(fromHexString(ALICE_PRIVATE));
byte[] aPub = fromHexString(ALICE_PUBLIC);
byte[] bPriv = Curve25519KeyParser.clamp(fromHexString(BOB_PRIVATE));
byte[] bPriv = AgreementKeyParser.clamp(fromHexString(BOB_PRIVATE));
byte[] bPub = fromHexString(BOB_PUBLIC);
byte[] sharedSecret = fromHexString(SHARED_SECRET);
Curve25519 curve25519 = Curve25519.getInstance("java");