mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 22:32:07 +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 =
|
val generator: PGPSignatureGenerator =
|
||||||
createSignatureGenerator(signingSubkey, hashAlgorithm, signatureType)
|
createSignatureGenerator(
|
||||||
|
signingSubkey,
|
||||||
|
signingKey.getPublicKey(signingSubkey.keyID).version,
|
||||||
|
hashAlgorithm,
|
||||||
|
signatureType)
|
||||||
|
|
||||||
// Subpackets
|
// Subpackets
|
||||||
val hashedSubpackets =
|
val hashedSubpackets =
|
||||||
|
@ -425,6 +429,7 @@ class SigningOptions {
|
||||||
@Throws(PGPException::class)
|
@Throws(PGPException::class)
|
||||||
private fun createSignatureGenerator(
|
private fun createSignatureGenerator(
|
||||||
privateKey: PGPPrivateKey,
|
privateKey: PGPPrivateKey,
|
||||||
|
signatureVersion: Int,
|
||||||
hashAlgorithm: HashAlgorithm,
|
hashAlgorithm: HashAlgorithm,
|
||||||
signatureType: DocumentSignatureType
|
signatureType: DocumentSignatureType
|
||||||
): PGPSignatureGenerator {
|
): PGPSignatureGenerator {
|
||||||
|
@ -432,7 +437,7 @@ class SigningOptions {
|
||||||
.getPGPContentSignerBuilder(
|
.getPGPContentSignerBuilder(
|
||||||
privateKey.publicKeyPacket.algorithm, hashAlgorithm.algorithmId)
|
privateKey.publicKeyPacket.algorithm, hashAlgorithm.algorithmId)
|
||||||
.let { csb ->
|
.let { csb ->
|
||||||
PGPSignatureGenerator(csb).also {
|
PGPSignatureGenerator(csb, signatureVersion).also {
|
||||||
it.init(signatureType.signatureType.code, privateKey)
|
it.init(signatureType.signatureType.code, privateKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,6 +379,10 @@ class Policy(
|
||||||
put(PublicKeyAlgorithm.DIFFIE_HELLMAN, 2000)
|
put(PublicKeyAlgorithm.DIFFIE_HELLMAN, 2000)
|
||||||
// §7.2.2
|
// §7.2.2
|
||||||
put(PublicKeyAlgorithm.ECDH, 250)
|
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