From 23b714f61b31eb93d70a8883ea2977e5ec85a401 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Thu, 14 Oct 2021 16:15:42 +0200 Subject: [PATCH] Only consider validly bound subkeys when determining latest key creation date --- .../src/main/java/org/pgpainless/key/info/KeyRingInfo.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 6c1b5778..f5a23ca0 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 @@ -532,13 +532,16 @@ public class KeyRingInfo { public @Nonnull Date getLatestKeyCreationDate() { Date latestCreation = null; for (PGPPublicKey key : getPublicKeys()) { + if (!isKeyValidlyBound(key.getKeyID())) { + continue; + } Date keyCreation = key.getCreationTime(); if (latestCreation == null || latestCreation.before(keyCreation)) { latestCreation = keyCreation; } } if (latestCreation == null) { - throw new AssertionError("Apparently there is no key in this key ring."); + throw new AssertionError("Apparently there is no validly bound key in this key ring."); } return latestCreation; }