1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-23 12:52:07 +01:00

Only consider validly bound subkeys when determining latest key creation date

This commit is contained in:
Paul Schaub 2021-10-14 16:15:42 +02:00
parent aef213a672
commit 23b714f61b
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -532,13 +532,16 @@ public class KeyRingInfo {
public @Nonnull Date getLatestKeyCreationDate() { public @Nonnull Date getLatestKeyCreationDate() {
Date latestCreation = null; Date latestCreation = null;
for (PGPPublicKey key : getPublicKeys()) { for (PGPPublicKey key : getPublicKeys()) {
if (!isKeyValidlyBound(key.getKeyID())) {
continue;
}
Date keyCreation = key.getCreationTime(); Date keyCreation = key.getCreationTime();
if (latestCreation == null || latestCreation.before(keyCreation)) { if (latestCreation == null || latestCreation.before(keyCreation)) {
latestCreation = keyCreation; latestCreation = keyCreation;
} }
} }
if (latestCreation == null) { 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; return latestCreation;
} }