From 7c102334edc86e3ff434c8bb0bf1014b6c172ff7 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Fri, 30 Oct 2020 13:30:04 +0100 Subject: [PATCH] expand expression to simplify debugging --- .../pgpainless/encryption_signing/EncryptionBuilder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionBuilder.java b/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionBuilder.java index 2d235f5e..b41111fa 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionBuilder.java +++ b/pgpainless-core/src/main/java/org/pgpainless/encryption_signing/EncryptionBuilder.java @@ -32,6 +32,7 @@ import org.bouncycastle.openpgp.PGPPublicKeyRingCollection; import org.bouncycastle.openpgp.PGPSecretKey; import org.bouncycastle.openpgp.PGPSecretKeyRing; import org.bouncycastle.openpgp.PGPSecretKeyRingCollection; +import org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor; import org.pgpainless.algorithm.CompressionAlgorithm; import org.pgpainless.algorithm.HashAlgorithm; import org.pgpainless.algorithm.SymmetricKeyAlgorithm; @@ -353,8 +354,9 @@ public class EncryptionBuilder implements EncryptionBuilderInterface { Map privateKeys = new ConcurrentHashMap<>(); for (PGPSecretKey secretKey : signingKeys) { - privateKeys.put(new OpenPgpV4Fingerprint(secretKey), - secretKey.extractPrivateKey(signingKeysDecryptor.getDecryptor(secretKey.getKeyID()))); + PBESecretKeyDecryptor decryptor = signingKeysDecryptor.getDecryptor(secretKey.getKeyID()); + PGPPrivateKey privateKey = secretKey.extractPrivateKey(decryptor); + privateKeys.put(new OpenPgpV4Fingerprint(secretKey), privateKey); } return new EncryptionStream(