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:
parent
5fc5c36452
commit
e3c60973c4
2 changed files with 11 additions and 2 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue