From fdf49cfafbea21f1d6ae30c2de5f4b152e213e1e Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Tue, 19 Nov 2024 13:59:41 +0100 Subject: [PATCH] Improve error message when no acceptable certificate signature is found Relates to #457 --- .../src/main/kotlin/org/pgpainless/key/info/KeyAccessor.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/key/info/KeyAccessor.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/key/info/KeyAccessor.kt index 11fe1643..f65bb7bc 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/key/info/KeyAccessor.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/key/info/KeyAccessor.kt @@ -71,7 +71,9 @@ abstract class KeyAccessor(protected val info: KeyRingInfo, protected val key: S return info.latestDirectKeySelfSignature } - return info.getCurrentSubkeyBindingSignature(key.subkeyId)!! + return info.getCurrentSubkeyBindingSignature(key.subkeyId) + ?: throw NoSuchElementException( + "Key does not carry acceptable self-signature signature.") } }