summaryrefslogtreecommitdiffstats
path: root/openpgp/examples/decrypt-with.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-02-12 13:36:22 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-02-12 15:12:21 +0100
commita6ff2539d4fcb569eba07c38d3ca992c266bdc57 (patch)
tree2cebe3adf218412f900e84713e55f2b0c5bfdbd4 /openpgp/examples/decrypt-with.rs
parentb0648d984bc618686a18d5e0a5173c16b2328549 (diff)
openpgp: Add optional cipher argument to DecryptionHelper::decrypt.
Diffstat (limited to 'openpgp/examples/decrypt-with.rs')
-rw-r--r--openpgp/examples/decrypt-with.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs
index a72f0a7d..860c4a56 100644
--- a/openpgp/examples/decrypt-with.rs
+++ b/openpgp/examples/decrypt-with.rs
@@ -84,6 +84,7 @@ impl DecryptionHelper for Helper {
fn decrypt<D>(&mut self,
pkesks: &[openpgp::packet::PKESK],
_skesks: &[openpgp::packet::SKESK],
+ sym_algo: Option<SymmetricAlgorithm>,
mut decrypt: D)
-> openpgp::Result<Option<openpgp::Fingerprint>>
where D: FnMut(SymmetricAlgorithm, &SessionKey) -> openpgp::Result<()>
@@ -91,7 +92,7 @@ impl DecryptionHelper for Helper {
// Try each PKESK until we succeed.
for pkesk in pkesks {
if let Some(pair) = self.keys.get_mut(pkesk.recipient()) {
- if let Ok(_) = pkesk.decrypt(pair, None)
+ if let Ok(_) = pkesk.decrypt(pair, sym_algo)
.and_then(|(algo, session_key)| decrypt(algo, &session_key))
{
break;