summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gemato/exceptions.py6
-rw-r--r--gemato/openpgp.py12
2 files changed, 10 insertions, 8 deletions
diff --git a/gemato/exceptions.py b/gemato/exceptions.py
index cf9208e..8492df9 100644
--- a/gemato/exceptions.py
+++ b/gemato/exceptions.py
@@ -120,8 +120,6 @@ class OpenPGPRuntimeError(GematoException):
Base exception class for OpenPGP runtime errors.
"""
- __slots__ = ['output']
-
def __init__(self, output):
super().__init__(output)
self.output = output
@@ -159,6 +157,10 @@ class OpenPGPVerificationFailure(OpenPGPRuntimeError):
An exception raised when OpenPGP verification fails.
"""
+ def __init__(self, output, sig_data=None):
+ super().__init__(output)
+ self.sig_data = sig_data
+
def __str__(self):
return f'OpenPGP verification failed:\n{self.output}'
diff --git a/gemato/openpgp.py b/gemato/openpgp.py
index 50166c4..8c1db59 100644
--- a/gemato/openpgp.py
+++ b/gemato/openpgp.py
@@ -239,23 +239,23 @@ class SystemGPGEnvironment:
OpenPGPSignatureStatus.NO_PUBLIC_KEY,
OpenPGPSignatureStatus.ERROR):
raise OpenPGPVerificationFailure(
- err.decode("utf8", errors="backslashreplace"))
+ err.decode("utf8", errors="backslashreplace"), sig)
elif sig.sig_status == OpenPGPSignatureStatus.EXPIRED_KEY:
raise OpenPGPExpiredKeyFailure(
- err.decode('utf8', errors='backslashreplace'))
+ err.decode('utf8', errors='backslashreplace'), sig)
elif sig.sig_status == OpenPGPSignatureStatus.REVOKED_KEY:
raise OpenPGPRevokedKeyFailure(
- err.decode('utf8', errors='backslashreplace'))
+ err.decode('utf8', errors='backslashreplace'), sig)
else:
raise OpenPGPUnknownSigFailure(
- err.decode('utf8', errors='backslashreplace'))
+ err.decode('utf8', errors='backslashreplace'), sig)
if not sig.valid_sig:
raise OpenPGPUnknownSigFailure(
- err.decode('utf8', errors='backslashreplace'))
+ err.decode('utf8', errors='backslashreplace'), sig)
if not sig.trusted_sig:
raise OpenPGPUntrustedSigFailure(
- err.decode('utf8', errors='backslashreplace'))
+ err.decode('utf8', errors='backslashreplace'), sig)
return sig_list