summaryrefslogtreecommitdiffstats
path: root/openpgp/examples
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-11-09 23:55:02 +0100
committerNeal H. Walfield <neal@pep.foundation>2019-11-10 00:05:23 +0100
commitb8e5ef908ee211daee84a0782a115ae7fc003ec0 (patch)
tree360698ced26dc36aad015e11b89137d613b89208 /openpgp/examples
parent365862ed513057900c0d6c106ec51dff0a09693e (diff)
openpgp: Distinguish bad signatures from those that are not alive.
- Return a different `VerificationResult` for signatures that are not alive (BadSignature) from signatures that are actually bad (BadCheck).
Diffstat (limited to 'openpgp/examples')
-rw-r--r--openpgp/examples/decrypt-with.rs6
-rw-r--r--openpgp/examples/generate-sign-verify.rs3
2 files changed, 9 insertions, 0 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs
index ad8920c0..4b5d231a 100644
--- a/openpgp/examples/decrypt-with.rs
+++ b/openpgp/examples/decrypt-with.rs
@@ -131,6 +131,12 @@ impl VerificationHelper for Helper {
.expect("good checksum has an issuer");
eprintln!("Good signature from {}", issuer);
},
+ NotAlive(ref sig) => {
+ let issuer = sig.issuer()
+ .expect("not alive has an issuer");
+ eprintln!("Good, but not alive signature from {}",
+ issuer);
+ },
MissingKey(ref sig) => {
let issuer = sig.issuer()
.expect("missing key checksum has an \
diff --git a/openpgp/examples/generate-sign-verify.rs b/openpgp/examples/generate-sign-verify.rs
index 8dae191c..bddacc71 100644
--- a/openpgp/examples/generate-sign-verify.rs
+++ b/openpgp/examples/generate-sign-verify.rs
@@ -108,6 +108,9 @@ impl<'a> VerificationHelper for Helper<'a> {
match results.get(0) {
Some(VerificationResult::GoodChecksum(..)) =>
good = true,
+ Some(VerificationResult::NotAlive(..)) =>
+ return Err(failure::err_msg(
+ "Signature good, but not alive")),
Some(VerificationResult::MissingKey(_)) =>
return Err(failure::err_msg(
"Missing key to verify signature")),