From aef213a672cb74edb95d678694cd6a288c55912a Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 14 Oct 2021 15:53:49 +0200 Subject: [PATCH] Fix AssertionError when determining encryption subkeys from set containing unbound key --- .../src/main/java/org/pgpainless/key/info/KeyRingInfo.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/info/KeyRingInfo.java b/pgpainless-core/src/main/java/org/pgpainless/key/info/KeyRingInfo.java index 64af5ebb..6c1b5778 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/info/KeyRingInfo.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/info/KeyRingInfo.java @@ -748,12 +748,13 @@ public class KeyRingInfo { List encryptionKeys = new ArrayList<>(); while (subkeys.hasNext()) { PGPPublicKey subKey = subkeys.next(); - Date subkeyExpiration = getSubkeyExpirationDate(new OpenPgpV4Fingerprint(subKey)); - if (subkeyExpiration != null && subkeyExpiration.before(new Date())) { + + if (!isKeyValidlyBound(subKey.getKeyID())) { continue; } - if (!isKeyValidlyBound(subKey.getKeyID())) { + Date subkeyExpiration = getSubkeyExpirationDate(new OpenPgpV4Fingerprint(subKey)); + if (subkeyExpiration != null && subkeyExpiration.before(new Date())) { continue; }