1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-22 20:32:05 +01:00

WIP: v6 signature creation

This commit is contained in:
Paul Schaub 2024-06-25 08:11:30 +02:00
parent 5fc5c36452
commit e3c60973c4
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 11 additions and 2 deletions

View file

@ -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)
}
}

View file

@ -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)
})
}
}