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

SigningOptions: Change map key type to OpenPGPComponentKey

This commit is contained in:
Paul Schaub 2025-11-27 15:31:46 +01:00
parent 88579d1120
commit 62caa81c6f
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 4 additions and 3 deletions

View file

@ -248,7 +248,7 @@ class EncryptionStream(
options.signingOptions.signingMethods.entries.reversed().forEach { (key, method) -> options.signingOptions.signingMethods.entries.reversed().forEach { (key, method) ->
method.signatureGenerator.generate().let { sig -> method.signatureGenerator.generate().let { sig ->
val documentSignature = OpenPGPDocumentSignature(sig, key.publicKey) val documentSignature = OpenPGPDocumentSignature(sig, key)
if (method.isDetached) { if (method.isDetached) {
resultBuilder.addDetachedSignature(documentSignature) resultBuilder.addDetachedSignature(documentSignature)
} }

View file

@ -7,6 +7,7 @@ package org.pgpainless.encryption_signing
import java.util.* import java.util.*
import org.bouncycastle.bcpg.KeyIdentifier import org.bouncycastle.bcpg.KeyIdentifier
import org.bouncycastle.openpgp.* import org.bouncycastle.openpgp.*
import org.bouncycastle.openpgp.api.OpenPGPCertificate.OpenPGPComponentKey
import org.bouncycastle.openpgp.api.OpenPGPImplementation import org.bouncycastle.openpgp.api.OpenPGPImplementation
import org.bouncycastle.openpgp.api.OpenPGPKey import org.bouncycastle.openpgp.api.OpenPGPKey
import org.bouncycastle.openpgp.api.OpenPGPKey.OpenPGPPrivateKey import org.bouncycastle.openpgp.api.OpenPGPKey.OpenPGPPrivateKey
@ -30,7 +31,7 @@ import org.pgpainless.signature.subpackets.SignatureSubpacketsHelper
class SigningOptions(private val api: PGPainless) { class SigningOptions(private val api: PGPainless) {
var hashAlgorithmNegotiator: HashAlgorithmNegotiator = var hashAlgorithmNegotiator: HashAlgorithmNegotiator =
negotiateSignatureHashAlgorithm(api.algorithmPolicy) negotiateSignatureHashAlgorithm(api.algorithmPolicy)
val signingMethods: Map<OpenPGPPrivateKey, SigningMethod> = mutableMapOf() val signingMethods: Map<OpenPGPComponentKey, SigningMethod> = mutableMapOf()
private var _hashAlgorithmOverride: HashAlgorithm? = null private var _hashAlgorithmOverride: HashAlgorithm? = null
private var _evaluationDate: Date = Date() private var _evaluationDate: Date = Date()
@ -525,7 +526,7 @@ class SigningOptions(private val api: PGPainless) {
publicKeyAlgorithm, bitStrength)) { publicKeyAlgorithm, bitStrength)) {
throw UnacceptableSigningKeyException( throw UnacceptableSigningKeyException(
PublicKeyAlgorithmPolicyException( PublicKeyAlgorithmPolicyException(
signingKey.secretKey, publicKeyAlgorithm, bitStrength)) signingKey, publicKeyAlgorithm, bitStrength))
} }
val generator: PGPSignatureGenerator = val generator: PGPSignatureGenerator =