mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 04:17:59 +01:00
Catch exceptions on malformed keys
This commit is contained in:
parent
ab0835d176
commit
ffae298142
1 changed files with 10 additions and 1 deletions
|
@ -12,6 +12,7 @@ import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
import org.bouncycastle.bcpg.sig.RevocationReason;
|
import org.bouncycastle.bcpg.sig.RevocationReason;
|
||||||
import org.bouncycastle.openpgp.PGPPublicKey;
|
import org.bouncycastle.openpgp.PGPPublicKey;
|
||||||
|
@ -193,11 +194,19 @@ public class WebOfTrust implements CertificateAuthority {
|
||||||
certsWithKey.add(cert);
|
certsWithKey.add(cert);
|
||||||
|
|
||||||
// index synopses
|
// index synopses
|
||||||
|
Date expirationDate;
|
||||||
|
try {
|
||||||
|
expirationDate = cert.getExpirationDateForUse(KeyFlag.CERTIFY_OTHER);
|
||||||
|
} catch (NoSuchElementException e) {
|
||||||
|
// Some keys are malformed and have no KeyFlags
|
||||||
|
return;
|
||||||
|
}
|
||||||
certSynopsisMap.put(cert.getFingerprint(),
|
certSynopsisMap.put(cert.getFingerprint(),
|
||||||
new CertSynopsis(cert.getFingerprint(),
|
new CertSynopsis(cert.getFingerprint(),
|
||||||
cert.getExpirationDateForUse(KeyFlag.CERTIFY_OTHER),
|
expirationDate,
|
||||||
revocationStateFromSignature(cert.getRevocationSelfSignature()),
|
revocationStateFromSignature(cert.getRevocationSelfSignature()),
|
||||||
new HashSet<>(cert.getValidUserIds())));
|
new HashSet<>(cert.getValidUserIds())));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void findEdges() {
|
private void findEdges() {
|
||||||
|
|
Loading…
Reference in a new issue