From a9cee6f45c005cb2230c1acdd0ad03783c1f20a8 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Wed, 29 Oct 2025 12:27:28 +0100 Subject: [PATCH] Fix exception when changing passphrase of key with stripped component key Fixes https://github.com/pgpainless/pgpainless/discussions/489\#discussioncomment-14796176 --- .../org/pgpainless/key/protection/fixes/S2KUsageFix.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pgpainless-core/src/main/kotlin/org/pgpainless/key/protection/fixes/S2KUsageFix.kt b/pgpainless-core/src/main/kotlin/org/pgpainless/key/protection/fixes/S2KUsageFix.kt index fee9047f..94df131a 100644 --- a/pgpainless-core/src/main/kotlin/org/pgpainless/key/protection/fixes/S2KUsageFix.kt +++ b/pgpainless-core/src/main/kotlin/org/pgpainless/key/protection/fixes/S2KUsageFix.kt @@ -65,6 +65,12 @@ class S2KUsageFix { "Missing passphrase for key with ID " + java.lang.Long.toHexString(keyId)) } + // skip stripped secret keys + if (key.isPrivateKeyEmpty) { + keyList.add(key) + continue + } + val privateKey = key.unlock(protector) // This constructor makes use of USAGE_SHA1 by default val fixedKey =