1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-09 05:41:07 +01:00

Rename PublicKeyAlgorithm.EDDSA to EDDSA_LEGACY

This commit is contained in:
Paul Schaub 2024-02-21 14:52:48 +01:00
parent 412f804eee
commit e933af94c7
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
8 changed files with 10 additions and 10 deletions

View file

@ -16,7 +16,7 @@ import org.pgpainless.key.generation.type.eddsa.EdDSACurve
/**
* 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].
*
@ -28,7 +28,7 @@ fun PGPPublicKey.getCurveName(): String {
when (it) {
PublicKeyAlgorithm.ECDSA -> publicKeyPacket.key as ECDSAPublicBCPGKey
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).")
}
}

View file

@ -60,7 +60,7 @@ enum class PublicKeyAlgorithm(
DIFFIE_HELLMAN(21, false, true),
/** Digital Signature Algorithm based on twisted Edwards Curves. */
EDDSA(22, true, false),
EDDSA_LEGACY(22, true, false),
;
fun isSigningCapable(): Boolean = signingCapable

View file

@ -10,7 +10,7 @@ import org.pgpainless.key.generation.type.KeyType
class EdDSA private constructor(val curve: EdDSACurve) : KeyType {
override val name = "EdDSA"
override val algorithm = PublicKeyAlgorithm.EDDSA
override val algorithm = PublicKeyAlgorithm.EDDSA_LEGACY
override val bitStrength = curve.bitStrength
override val algorithmSpec = ECNamedCurveGenParameterSpec(curve.curveName)

View file

@ -374,7 +374,7 @@ class Policy(
put(PublicKeyAlgorithm.ECDSA, 250)
// Note: EdDSA is not mentioned in the BSI document.
// We assume that the requirements are similar to other EC algorithms.
put(PublicKeyAlgorithm.EDDSA, 250)
put(PublicKeyAlgorithm.EDDSA_LEGACY, 250)
// §7.2.1
put(PublicKeyAlgorithm.DIFFIE_HELLMAN, 2000)
// §7.2.2