mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 06:12:06 +01:00
Rename PublicKeyAlgorithm.EDDSA to EDDSA_LEGACY
This commit is contained in:
parent
412f804eee
commit
e933af94c7
8 changed files with 10 additions and 10 deletions
|
@ -16,7 +16,7 @@ import org.pgpainless.key.generation.type.eddsa.EdDSACurve
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For secret keys of types [PublicKeyAlgorithm.ECDSA], [PublicKeyAlgorithm.ECDH] and
|
* For secret keys of types [PublicKeyAlgorithm.ECDSA], [PublicKeyAlgorithm.ECDH] and
|
||||||
* [PublicKeyAlgorithm.EDDSA], this method returns the name of the underlying elliptic curve.
|
* [PublicKeyAlgorithm.EDDSA_LEGACY], this method returns the name of the underlying elliptic curve.
|
||||||
*
|
*
|
||||||
* For other key types or unknown curves, this method throws an [IllegalArgumentException].
|
* For other key types or unknown curves, this method throws an [IllegalArgumentException].
|
||||||
*
|
*
|
||||||
|
@ -28,7 +28,7 @@ fun PGPPublicKey.getCurveName(): String {
|
||||||
when (it) {
|
when (it) {
|
||||||
PublicKeyAlgorithm.ECDSA -> publicKeyPacket.key as ECDSAPublicBCPGKey
|
PublicKeyAlgorithm.ECDSA -> publicKeyPacket.key as ECDSAPublicBCPGKey
|
||||||
PublicKeyAlgorithm.ECDH -> publicKeyPacket.key as ECDHPublicBCPGKey
|
PublicKeyAlgorithm.ECDH -> publicKeyPacket.key as ECDHPublicBCPGKey
|
||||||
PublicKeyAlgorithm.EDDSA -> publicKeyPacket.key as EdDSAPublicBCPGKey
|
PublicKeyAlgorithm.EDDSA_LEGACY -> publicKeyPacket.key as EdDSAPublicBCPGKey
|
||||||
else -> throw IllegalArgumentException("No an elliptic curve public key ($it).")
|
else -> throw IllegalArgumentException("No an elliptic curve public key ($it).")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ enum class PublicKeyAlgorithm(
|
||||||
DIFFIE_HELLMAN(21, false, true),
|
DIFFIE_HELLMAN(21, false, true),
|
||||||
|
|
||||||
/** Digital Signature Algorithm based on twisted Edwards Curves. */
|
/** Digital Signature Algorithm based on twisted Edwards Curves. */
|
||||||
EDDSA(22, true, false),
|
EDDSA_LEGACY(22, true, false),
|
||||||
;
|
;
|
||||||
|
|
||||||
fun isSigningCapable(): Boolean = signingCapable
|
fun isSigningCapable(): Boolean = signingCapable
|
||||||
|
|
|
@ -10,7 +10,7 @@ import org.pgpainless.key.generation.type.KeyType
|
||||||
|
|
||||||
class EdDSA private constructor(val curve: EdDSACurve) : KeyType {
|
class EdDSA private constructor(val curve: EdDSACurve) : KeyType {
|
||||||
override val name = "EdDSA"
|
override val name = "EdDSA"
|
||||||
override val algorithm = PublicKeyAlgorithm.EDDSA
|
override val algorithm = PublicKeyAlgorithm.EDDSA_LEGACY
|
||||||
override val bitStrength = curve.bitStrength
|
override val bitStrength = curve.bitStrength
|
||||||
override val algorithmSpec = ECNamedCurveGenParameterSpec(curve.curveName)
|
override val algorithmSpec = ECNamedCurveGenParameterSpec(curve.curveName)
|
||||||
|
|
||||||
|
|
|
@ -374,7 +374,7 @@ class Policy(
|
||||||
put(PublicKeyAlgorithm.ECDSA, 250)
|
put(PublicKeyAlgorithm.ECDSA, 250)
|
||||||
// Note: EdDSA is not mentioned in the BSI document.
|
// Note: EdDSA is not mentioned in the BSI document.
|
||||||
// We assume that the requirements are similar to other EC algorithms.
|
// We assume that the requirements are similar to other EC algorithms.
|
||||||
put(PublicKeyAlgorithm.EDDSA, 250)
|
put(PublicKeyAlgorithm.EDDSA_LEGACY, 250)
|
||||||
// §7.2.1
|
// §7.2.1
|
||||||
put(PublicKeyAlgorithm.DIFFIE_HELLMAN, 2000)
|
put(PublicKeyAlgorithm.DIFFIE_HELLMAN, 2000)
|
||||||
// §7.2.2
|
// §7.2.2
|
||||||
|
|
|
@ -74,9 +74,9 @@ public class GenerateKeys {
|
||||||
KeyRingInfo keyInfo = new KeyRingInfo(secretKey);
|
KeyRingInfo keyInfo = new KeyRingInfo(secretKey);
|
||||||
assertEquals(3, keyInfo.getSecretKeys().size());
|
assertEquals(3, keyInfo.getSecretKeys().size());
|
||||||
assertEquals(userId, keyInfo.getPrimaryUserId());
|
assertEquals(userId, keyInfo.getPrimaryUserId());
|
||||||
assertEquals(PublicKeyAlgorithm.EDDSA.getAlgorithmId(),
|
assertEquals(PublicKeyAlgorithm.EDDSA_LEGACY.getAlgorithmId(),
|
||||||
keyInfo.getPublicKey().getAlgorithm());
|
keyInfo.getPublicKey().getAlgorithm());
|
||||||
assertEquals(PublicKeyAlgorithm.EDDSA.getAlgorithmId(),
|
assertEquals(PublicKeyAlgorithm.EDDSA_LEGACY.getAlgorithmId(),
|
||||||
keyInfo.getSigningSubkeys().get(0).getAlgorithm());
|
keyInfo.getSigningSubkeys().get(0).getAlgorithm());
|
||||||
assertEquals(PublicKeyAlgorithm.ECDH.getAlgorithmId(),
|
assertEquals(PublicKeyAlgorithm.ECDH.getAlgorithmId(),
|
||||||
keyInfo.getEncryptionSubkeys(EncryptionPurpose.ANY).get(0).getAlgorithm());
|
keyInfo.getEncryptionSubkeys(EncryptionPurpose.ANY).get(0).getAlgorithm());
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class GenerateEllipticCurveKeyTest {
|
||||||
.addUserId(UserId.onlyEmail("alice@wonderland.lit").toString())
|
.addUserId(UserId.onlyEmail("alice@wonderland.lit").toString())
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
assertEquals(PublicKeyAlgorithm.EDDSA.getAlgorithmId(), keyRing.getPublicKey().getAlgorithm());
|
assertEquals(PublicKeyAlgorithm.EDDSA_LEGACY.getAlgorithmId(), keyRing.getPublicKey().getAlgorithm());
|
||||||
UnlockSecretKey.unlockSecretKey(keyRing.getSecretKey(), SecretKeyRingProtector.unprotectedKeys());
|
UnlockSecretKey.unlockSecretKey(keyRing.getSecretKey(), SecretKeyRingProtector.unprotectedKeys());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class RefuseToAddWeakSubkeyTest {
|
||||||
minimalBitStrengths.put(PublicKeyAlgorithm.ECDSA, 250);
|
minimalBitStrengths.put(PublicKeyAlgorithm.ECDSA, 250);
|
||||||
// Note: EdDSA is not mentioned in the BSI document.
|
// Note: EdDSA is not mentioned in the BSI document.
|
||||||
// We assume that the requirements are similar to other EC algorithms.
|
// We assume that the requirements are similar to other EC algorithms.
|
||||||
minimalBitStrengths.put(PublicKeyAlgorithm.EDDSA, 250);
|
minimalBitStrengths.put(PublicKeyAlgorithm.EDDSA_LEGACY, 250);
|
||||||
// §7.2.1
|
// §7.2.1
|
||||||
minimalBitStrengths.put(PublicKeyAlgorithm.DIFFIE_HELLMAN, 2000);
|
minimalBitStrengths.put(PublicKeyAlgorithm.DIFFIE_HELLMAN, 2000);
|
||||||
// §7.2.2
|
// §7.2.2
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class OnePassSignatureBracketingTest {
|
||||||
// 4 is hash algo
|
// 4 is hash algo
|
||||||
assertEquals(HashAlgorithm.SHA512.getAlgorithmId(), encoded[4]);
|
assertEquals(HashAlgorithm.SHA512.getAlgorithmId(), encoded[4]);
|
||||||
// 5 is public key algo
|
// 5 is public key algo
|
||||||
assertEquals(PublicKeyAlgorithm.EDDSA.getAlgorithmId(), encoded[5]);
|
assertEquals(PublicKeyAlgorithm.EDDSA_LEGACY.getAlgorithmId(), encoded[5]);
|
||||||
// [6,7,8,9,10,11,12,13] are key-id
|
// [6,7,8,9,10,11,12,13] are key-id
|
||||||
|
|
||||||
boolean last = i == signatures.size() - 1;
|
boolean last = i == signatures.size() - 1;
|
||||||
|
|
Loading…
Reference in a new issue