diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-13 18:31:28 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-13 21:21:35 +0100 |
commit | 78ebbf05c9839771ae5dc3ce0c1c3cd278f0bde4 (patch) | |
tree | 73eebd625ff7a96fb03808fb0919e6d19900f93b /tool/src/commands/mod.rs | |
parent | 4b2288ad66cc894956dc3511259b2a75bfc94301 (diff) |
openpgp: Add Error variant to VerificationResult.
- Add an Error variant to VerificationResult.
Diffstat (limited to 'tool/src/commands/mod.rs')
-rw-r--r-- | tool/src/commands/mod.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tool/src/commands/mod.rs b/tool/src/commands/mod.rs index 25b94198..a8e8a93b 100644 --- a/tool/src/commands/mod.rs +++ b/tool/src/commands/mod.rs @@ -192,6 +192,7 @@ struct VHelper<'a> { unknown_checksums: usize, bad_signatures: usize, bad_checksums: usize, + broken_signatures: usize, } impl<'a> VHelper<'a> { @@ -210,6 +211,7 @@ impl<'a> VHelper<'a> { unknown_checksums: 0, bad_signatures: 0, bad_checksums: 0, + broken_signatures: 0, } } @@ -230,6 +232,7 @@ impl<'a> VHelper<'a> { p(&mut dirty, "unknown checksum", self.unknown_checksums); p(&mut dirty, "bad signature", self.bad_signatures); p(&mut dirty, "bad checksum", self.bad_checksums); + p(&mut dirty, "broken signatures", self.broken_signatures); if dirty { eprintln!("."); } @@ -238,6 +241,19 @@ impl<'a> VHelper<'a> { fn print_sigs(&mut self, results: &[VerificationResult]) { use self::VerificationResult::*; for result in results { + if let Error { sig, error } = result { + let issuer = sig.get_issuers().iter().nth(0) + .expect("key has an issuer") + .to_string(); + let what = match sig.level() { + 0 => "checksum".into(), + n => format!("level {} notarizing checksum", n), + }; + eprintln!("Error verifying {} from {}: {}", + what, issuer, error); + self.broken_signatures += 1; + continue; + } if let MissingKey { sig } = result { let issuer = sig.get_issuers().iter().nth(0) .expect("missing key checksum has an issuer") @@ -257,6 +273,7 @@ impl<'a> VHelper<'a> { | BadChecksum { sig, ka, .. } => (ka.key().keyid(), sig.level()), MissingKey { .. } => unreachable!("handled above"), + Error { .. } => unreachable!("handled above"), }; let trusted = self.trusted.contains(&issuer); @@ -297,6 +314,7 @@ impl<'a> VHelper<'a> { } }, MissingKey { .. } => unreachable!("handled above"), + Error { .. } => unreachable!("handled above"), } } } |