diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-06-24 09:53:27 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-06-24 17:57:53 +0200 |
commit | 664316de70555d350886cd2c416b3c7da86af3ad (patch) | |
tree | 19aee7789581b1d998bd1bda89688cefbd06b41b | |
parent | 660e5352c0cb57f0a9f49bf0d9367b723884f2db (diff) |
openpgp, tool: Fix decryption.
- Try to decrypt all PKESKs, not just the first one.
-rw-r--r-- | openpgp/examples/decrypt-with.rs | 2 | ||||
-rw-r--r-- | tool/src/commands/decrypt.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs index a13dc98b..75b886eb 100644 --- a/openpgp/examples/decrypt-with.rs +++ b/openpgp/examples/decrypt-with.rs @@ -88,7 +88,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(_) = pkesks[0].decrypt(pair) + if let Ok(_) = pkesk.decrypt(pair) .and_then(|(algo, session_key)| decrypt(algo, &session_key)) { break; diff --git a/tool/src/commands/decrypt.rs b/tool/src/commands/decrypt.rs index a8c72f96..37e00a9f 100644 --- a/tool/src/commands/decrypt.rs +++ b/tool/src/commands/decrypt.rs @@ -124,7 +124,7 @@ impl<'a> DecryptionHelper for Helper<'a> { if let Some(key) = self.secret_keys.get(&keyid) { if let Some(SecretKey::Unencrypted { .. }) = key.secret() { if let Ok(sk) = key.clone().into_keypair() - .and_then(|mut keypair| pkesks[0].decrypt(&mut keypair)) + .and_then(|mut keypair| pkesk.decrypt(&mut keypair)) .and_then(|(algo, sk)| { decrypt(algo, &sk)?; Ok(sk) }) { if self.dump_session_key { |