diff options
author | Michał Górny <mgorny@gentoo.org> | 2023-01-22 09:35:44 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2023-01-22 09:35:44 +0100 |
commit | 39c3a6c0d9ce83becb768a545b07290e1f6002d3 (patch) | |
tree | b64ec18193dfb14daf4c7240de7c38f8890c6957 | |
parent | 9f57167b0cacf9fff0c23275fdb0666ebfc2be57 (diff) | |
download | gemato-39c3a6c0d9ce83becb768a545b07290e1f6002d3.tar.gz |
openpgp: Distinguish NO_PUBLIC_KEY status
Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r-- | gemato/openpgp.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gemato/openpgp.py b/gemato/openpgp.py index cf8c799..50166c4 100644 --- a/gemato/openpgp.py +++ b/gemato/openpgp.py @@ -51,6 +51,7 @@ class OpenPGPSignatureStatus(enum.Enum): GOOD = enum.auto() BAD = enum.auto() EXPIRED = enum.auto() + NO_PUBLIC_KEY = enum.auto() ERROR = enum.auto() EXPIRED_KEY = enum.auto() REVOKED_KEY = enum.auto() @@ -194,7 +195,13 @@ class SystemGPGEnvironment: sig_list[-1].sig_status = OpenPGPSignatureStatus.EXPIRED elif line.startswith(b"[GNUPG:] ERRSIG"): assert sig_list and sig_list[-1].sig_status is None - sig_list[-1].sig_status = OpenPGPSignatureStatus.ERROR + spl = line.split(b" ") + assert len(spl) >= 8 + if spl[7] == b"9": + sig_list[-1].sig_status = ( + OpenPGPSignatureStatus.NO_PUBLIC_KEY) + else: + sig_list[-1].sig_status = OpenPGPSignatureStatus.ERROR elif line.startswith(b'[GNUPG:] EXPKEYSIG'): assert sig_list and sig_list[-1].sig_status is None sig_list[-1].sig_status = OpenPGPSignatureStatus.EXPIRED_KEY @@ -229,6 +236,7 @@ class SystemGPGEnvironment: pass elif sig.sig_status in (OpenPGPSignatureStatus.BAD, OpenPGPSignatureStatus.EXPIRED, + OpenPGPSignatureStatus.NO_PUBLIC_KEY, OpenPGPSignatureStatus.ERROR): raise OpenPGPVerificationFailure( err.decode("utf8", errors="backslashreplace")) |