diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/encryption_signing/SigningOptions.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/encryption_signing/SigningOptions.kt index e0fe2972..1e8cd545 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/encryption_signing/SigningOptions.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/encryption_signing/SigningOptions.kt @@ -383,7 +383,11 @@ class SigningOptions { } val generator: PGPSignatureGenerator = - createSignatureGenerator(signingSubkey, hashAlgorithm, signatureType) + createSignatureGenerator( + signingSubkey, + signingKey.getPublicKey(signingSubkey.keyID).version, + hashAlgorithm, + signatureType) // Subpackets val hashedSubpackets = @@ -425,6 +429,7 @@ class SigningOptions { @Throws(PGPException::class) private fun createSignatureGenerator( privateKey: PGPPrivateKey, + signatureVersion: Int, hashAlgorithm: HashAlgorithm, signatureType: DocumentSignatureType ): PGPSignatureGenerator { @@ -432,7 +437,7 @@ class SigningOptions { .getPGPContentSignerBuilder( privateKey.publicKeyPacket.algorithm, hashAlgorithm.algorithmId) .let { csb -> - PGPSignatureGenerator(csb).also { + PGPSignatureGenerator(csb, signatureVersion).also { it.init(signatureType.signatureType.code, privateKey) } } diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/policy/Policy.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/policy/Policy.kt index 7c6bb2d3..93c6c19f 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/policy/Policy.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/policy/Policy.kt @@ -379,6 +379,10 @@ class Policy( put(PublicKeyAlgorithm.DIFFIE_HELLMAN, 2000) // ยง7.2.2 put(PublicKeyAlgorithm.ECDH, 250) + put(PublicKeyAlgorithm.ED25519, 0) + put(PublicKeyAlgorithm.ED448, 0) + put(PublicKeyAlgorithm.X25519, 0) + put(PublicKeyAlgorithm.X448, 0) }) } }