From dcfafb4fe13dff9939bf1c09b948b4267f6bd518 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Wed, 24 Jan 2018 19:03:11 +0100 Subject: openpgp: Refactor status processing not to stop on GOODSIG --- gemato/openpgp.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gemato/openpgp.py b/gemato/openpgp.py index 6fa500a..051cfc1 100644 --- a/gemato/openpgp.py +++ b/gemato/openpgp.py @@ -63,15 +63,18 @@ class OpenPGPSystemEnvironment(object): if exitst != 0: raise gemato.exceptions.OpenPGPVerificationFailure(err.decode('utf8')) + is_good = False + # process the output of gpg to find the exact result for l in out.splitlines(): if l.startswith(b'[GNUPG:] GOODSIG'): - break + is_good = True elif l.startswith(b'[GNUPG:] EXPKEYSIG'): raise gemato.exceptions.OpenPGPExpiredKeyFailure(err.decode('utf8')) elif l.startswith(b'[GNUPG:] REVKEYSIG'): raise gemato.exceptions.OpenPGPRevokedKeyFailure(err.decode('utf8')) - else: + + if not is_good: raise gemato.exceptions.OpenPGPUnknownSigFailure(err.decode('utf8')) def clear_sign_file(self, f, outf, keyid=None): -- cgit v1.2.3