1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-09 05:41:07 +01:00

Ensure proper compatibility with keys with missing direct-key or certification self-sigs

This commit is contained in:
Paul Schaub 2023-11-08 15:16:41 +01:00
parent 6fdf136024
commit 620c1fc96a
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
3 changed files with 117 additions and 2 deletions

View file

@ -67,9 +67,11 @@ abstract class KeyAccessor(protected val info: KeyRingInfo, protected val key: S
info.getLatestUserIdCertification(userId).let { if (it != null) return it }
}
return checkNotNull(info.latestDirectKeySelfSignature) {
"No valid signature found."
if (info.latestDirectKeySelfSignature != null) {
return info.latestDirectKeySelfSignature
}
return info.getCurrentSubkeyBindingSignature(key.subkeyId)!!
}
}

View file

@ -172,8 +172,11 @@ class KeyRingInfo(
primaryUserIdCertification?.let { getKeyExpirationTimeAsDate(it, publicKey) }
if (latestDirectKeySelfSignature == null && primaryUserIdCertification == null) {
/*
throw NoSuchElementException(
"No direct-key signature and no user-id signature found.")
*/
return null
}
if (directKeyExpirationDate != null && userIdExpirationDate == null) {
return directKeyExpirationDate