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; }