From 17ba3c38797bd2489d5c8294de05889c70c91f20 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Wed, 8 Sep 2021 11:59:28 +0200 Subject: [PATCH] SecretKeyRingEditor: Take not only positive, but also generic,casual certifications into consideration --- .../modification/secretkeyring/SecretKeyRingEditor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditor.java b/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditor.java index e54c2064..97834e35 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditor.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/modification/secretkeyring/SecretKeyRingEditor.java @@ -416,12 +416,15 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface { Iterator keySignatures = subjectPubKey.getSignaturesForKeyID(primaryKey.getKeyID()); while (keySignatures.hasNext()) { PGPSignature next = keySignatures.next(); - if (next.getSignatureType() == PGPSignature.POSITIVE_CERTIFICATION) { + SignatureType type = SignatureType.valueOf(next.getSignatureType()); + if (type == SignatureType.POSITIVE_CERTIFICATION || + type == SignatureType.CASUAL_CERTIFICATION || + type == SignatureType.GENERIC_CERTIFICATION) { oldSignature = next; } } if (oldSignature == null) { - throw new IllegalStateException("Key " + new OpenPgpV4Fingerprint(subjectPubKey) + " does not have a previous positive signature."); + throw new IllegalStateException("Key " + new OpenPgpV4Fingerprint(subjectPubKey) + " does not have a previous positive/casual/generic certification signature."); } } else { Iterator bindingSignatures = subjectPubKey.getSignaturesOfType(SignatureType.SUBKEY_BINDING.getCode());