1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-15 17:02:06 +01:00

Fix NPE when encountering missing because expired cert

This commit is contained in:
Paul Schaub 2023-07-08 00:54:34 +02:00
parent f2db1efa61
commit 6f19f3a89e
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -115,6 +115,7 @@ class WebOfTrust(private val certificateStore: PGPCertificateStore) {
cert.getExpirationDateForUse(KeyFlag.CERTIFY_OTHER) cert.getExpirationDateForUse(KeyFlag.CERTIFY_OTHER)
} catch (e: NoSuchElementException) { } catch (e: NoSuchElementException) {
// Some keys are malformed and have no KeyFlags // Some keys are malformed and have no KeyFlags
// TODO: We also end up here for expired keys unfortunately
return return
} }
@ -149,7 +150,7 @@ class WebOfTrust(private val certificateStore: PGPCertificateStore) {
val validatedTargetKeyRing = KeyRingUtils.publicKeys(validatedTarget.keys) val validatedTargetKeyRing = KeyRingUtils.publicKeys(validatedTarget.keys)
val targetFingerprint = Fingerprint(OpenPgpFingerprint.of(validatedTargetKeyRing)) val targetFingerprint = Fingerprint(OpenPgpFingerprint.of(validatedTargetKeyRing))
val targetPrimaryKey = validatedTargetKeyRing.publicKey!! val targetPrimaryKey = validatedTargetKeyRing.publicKey!!
val target = nodeMap[targetFingerprint]!! val target = nodeMap[targetFingerprint] ?: return // skip over expired keys for now :/
// Direct-Key Signatures (delegations) by X on Y // Direct-Key Signatures (delegations) by X on Y
val delegations = SignatureUtils.getDelegations(validatedTargetKeyRing) val delegations = SignatureUtils.getDelegations(validatedTargetKeyRing)