summaryrefslogtreecommitdiffstats
path: root/ipc/examples
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-02-19 12:18:01 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-02-19 12:46:58 +0100
commitef396882bc35a97d778e985cd69ebd5181852d8c (patch)
tree6e7945e1394ff82e5a72badc933ddac710c108cc /ipc/examples
parent32174f69cd4d94b4f621f3273781d487e97fa031 (diff)
openpgp: Split VerificationResult.
- Split VerificationResult into Result<GoodChecksum, VerificationError>. - Fixes #416.
Diffstat (limited to 'ipc/examples')
-rw-r--r--ipc/examples/gpg-agent-decrypt.rs33
1 files changed, 22 insertions, 11 deletions
diff --git a/ipc/examples/gpg-agent-decrypt.rs b/ipc/examples/gpg-agent-decrypt.rs
index 97397363..16d3a85a 100644
--- a/ipc/examples/gpg-agent-decrypt.rs
+++ b/ipc/examples/gpg-agent-decrypt.rs
@@ -16,7 +16,8 @@ use crate::openpgp::parse::{
DecryptionHelper,
Decryptor,
VerificationHelper,
- VerificationResult,
+ GoodChecksum,
+ VerificationError,
MessageStructure,
MessageLayer,
},
@@ -125,7 +126,7 @@ impl<'a> VerificationHelper for Helper<'a> {
}
fn check(&mut self, structure: MessageStructure)
-> failure::Fallible<()> {
- use self::VerificationResult::*;
+ use self::VerificationError::*;
for layer in structure.iter() {
match layer {
MessageLayer::Compression { algo } =>
@@ -140,20 +141,30 @@ impl<'a> VerificationHelper for Helper<'a> {
MessageLayer::SignatureGroup { ref results } =>
for result in results {
match result {
- GoodChecksum { cert, .. } => {
- eprintln!("Good signature from {}", cert);
+ Ok(GoodChecksum { ka, .. }) => {
+ eprintln!("Good signature from {}", ka.cert());
},
- NotAlive { sig, .. } => {
- eprintln!("Good, but not alive signature from {:?}",
- sig.get_issuers());
+ Err(MalformedSignature { error, .. }) => {
+ eprintln!("Signature is malformed: {}", error);
},
- MissingKey { .. } => {
- eprintln!("No key to check signature");
+ Err(MissingKey { sig, .. }) => {
+ let issuers = sig.get_issuers();
+ eprintln!("Missing key {}, which is needed to \
+ verify signature.",
+ issuers.first().unwrap().to_hex());
},
- Error { error, .. } => {
- eprintln!("Error verifying signature: {}",
+ Err(UnboundKey { cert, error, .. }) => {
+ eprintln!("Signing key on {} is not bound: {}",
+ cert.fingerprint().to_hex(), error);
+ },
+ Err(BadKey { ka, error, .. }) => {
+ eprintln!("Signing key on {} is bad: {}",
+ ka.cert().fingerprint().to_hex(),
error);
},
+ Err(BadSignature { error, .. }) => {
+ eprintln!("Verifying signature: {}.", error);
+ },
}
}
}