Use proper method to unlock private key when detached-signing

This commit is contained in:
Paul Schaub 2022-12-13 16:11:17 +01:00
parent ec7237390a
commit fad5603c69
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 1 additions and 2 deletions

View File

@ -359,8 +359,7 @@ public final class SigningOptions {
if (signingSecKey == null) {
throw new KeyException.MissingSecretKeyException(OpenPgpFingerprint.of(secretKey), signingPubKey.getKeyID());
}
PGPPrivateKey signingSubkey = signingSecKey.extractPrivateKey(
secretKeyDecryptor.getDecryptor(signingPubKey.getKeyID()));
PGPPrivateKey signingSubkey = UnlockSecretKey.unlockSecretKey(signingSecKey, secretKeyDecryptor);
Set<HashAlgorithm> hashAlgorithms = userId != null ? keyRingInfo.getPreferredHashAlgorithms(userId)
: keyRingInfo.getPreferredHashAlgorithms(signingPubKey.getKeyID());
HashAlgorithm hashAlgorithm = negotiateHashAlgorithm(hashAlgorithms, PGPainless.getPolicy());