From 5eb6ad9f545291f05f5f2455684da68594c8a4dd Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 27 Nov 2019 14:07:58 +0100 Subject: openpgp: Fix issuer handling in the streaming verifier. - To that end, make VerificationHelper::get_public_keys take KeyHandles for all the issuers. --- tool/src/commands/decrypt.rs | 2 +- tool/src/commands/mod.rs | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'tool/src') diff --git a/tool/src/commands/decrypt.rs b/tool/src/commands/decrypt.rs index b85e6797..33725290 100644 --- a/tool/src/commands/decrypt.rs +++ b/tool/src/commands/decrypt.rs @@ -123,7 +123,7 @@ impl<'a> Helper<'a> { } impl<'a> VerificationHelper for Helper<'a> { - fn get_public_keys(&mut self, ids: &[KeyID]) -> Result> { + fn get_public_keys(&mut self, ids: &[openpgp::KeyHandle]) -> Result> { self.vhelper.get_public_keys(ids) } fn check(&mut self, structure: &MessageStructure) -> Result<()> { diff --git a/tool/src/commands/mod.rs b/tool/src/commands/mod.rs index a7b76038..03af9aa6 100644 --- a/tool/src/commands/mod.rs +++ b/tool/src/commands/mod.rs @@ -301,7 +301,7 @@ impl<'a> VHelper<'a> { } impl<'a> VerificationHelper for VHelper<'a> { - fn get_public_keys(&mut self, ids: &[KeyID]) -> Result> { + fn get_public_keys(&mut self, ids: &[openpgp::KeyHandle]) -> Result> { let mut tpks = self.tpks.take().unwrap(); let seen: HashSet<_> = tpks.iter() .flat_map(|tpk| { @@ -314,9 +314,11 @@ impl<'a> VerificationHelper for VHelper<'a> { self.trusted = seen.clone(); // Try to get missing TPKs from the mapping. - for id in ids.iter().filter(|i| !seen.contains(i)) { + for id in ids.iter().map(|i| KeyID::from(i.clone())) + .filter(|i| !seen.contains(i)) + { let _ = - self.mapping.lookup_by_subkeyid(id) + self.mapping.lookup_by_subkeyid(&id) .and_then(|binding| { self.labels.insert(id.clone(), binding.label()?); @@ -335,9 +337,11 @@ impl<'a> VerificationHelper for VHelper<'a> { let seen = self.trusted.clone(); // Try to get missing TPKs from the pool. - for id in ids.iter().filter(|i| !seen.contains(i)) { + for id in ids.iter().map(|i| KeyID::from(i.clone())) + .filter(|i| !seen.contains(i)) + { let _ = - store::Store::lookup_by_subkeyid(self.ctx, id) + store::Store::lookup_by_subkeyid(self.ctx, &id) .and_then(|key| { // Keys from the pool are NOT trusted. key.tpk() -- cgit v1.2.3