1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-23 11:27:57 +01:00

SecretKeyRingEditor: Take not only positive, but also generic,casual certifications into consideration

This commit is contained in:
Paul Schaub 2021-09-08 11:59:28 +02:00
parent c942238b40
commit 17ba3c3879
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -416,12 +416,15 @@ public class SecretKeyRingEditor implements SecretKeyRingEditorInterface {
Iterator<PGPSignature> keySignatures = subjectPubKey.getSignaturesForKeyID(primaryKey.getKeyID()); Iterator<PGPSignature> keySignatures = subjectPubKey.getSignaturesForKeyID(primaryKey.getKeyID());
while (keySignatures.hasNext()) { while (keySignatures.hasNext()) {
PGPSignature next = keySignatures.next(); 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; oldSignature = next;
} }
} }
if (oldSignature == null) { 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 { } else {
Iterator<PGPSignature> bindingSignatures = subjectPubKey.getSignaturesOfType(SignatureType.SUBKEY_BINDING.getCode()); Iterator<PGPSignature> bindingSignatures = subjectPubKey.getSignaturesOfType(SignatureType.SUBKEY_BINDING.getCode());