summaryrefslogtreecommitdiffstats
path: root/openpgp/src
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-01-13 18:31:28 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-01-13 21:21:35 +0100
commit78ebbf05c9839771ae5dc3ce0c1c3cd278f0bde4 (patch)
tree73eebd625ff7a96fb03808fb0919e6d19900f93b /openpgp/src
parent4b2288ad66cc894956dc3511259b2a75bfc94301 (diff)
openpgp: Add Error variant to VerificationResult.
- Add an Error variant to VerificationResult.
Diffstat (limited to 'openpgp/src')
-rw-r--r--openpgp/src/parse/stream.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs
index fd278e16..336f64e0 100644
--- a/openpgp/src/parse/stream.rs
+++ b/openpgp/src/parse/stream.rs
@@ -212,6 +212,20 @@ pub enum VerificationResult<'a> {
/// The signing key that made the signature.
ka: KeyAmalgamation<'a, key::PublicParts>,
},
+
+ /// An error occured while verifying the signature.
+ ///
+ /// This could occur if the signature is invalid (e.g., no
+ /// Signature Creation Time packet), the key is invalid (e.g., the
+ /// key is not alive, the key is revoked, the key is not signing
+ /// capable), etc.
+ Error {
+ /// The signature.
+ sig: Signature,
+
+ /// The reason.
+ error: failure::Error,
+ },
}
impl<'a> VerificationResult<'a> {
@@ -223,6 +237,7 @@ impl<'a> VerificationResult<'a> {
NotAlive { sig, .. } => sig.level(),
MissingKey { sig, .. } => sig.level(),
BadChecksum { sig, .. } => sig.level(),
+ Error { sig, .. } => sig.level(),
}
}
}
@@ -1772,6 +1787,7 @@ mod test {
MissingKey { .. } => self.unknown += 1,
NotAlive { .. } => self.bad += 1,
BadChecksum { .. } => self.bad += 1,
+ Error { .. } => self.bad += 1,
}
}
MessageLayer::Compression { .. } => (),