summaryrefslogtreecommitdiffstats
path: root/openpgp/examples/generate-encrypt-decrypt.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/examples/generate-encrypt-decrypt.rs')
-rw-r--r--openpgp/examples/generate-encrypt-decrypt.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/openpgp/examples/generate-encrypt-decrypt.rs b/openpgp/examples/generate-encrypt-decrypt.rs
index 4d456193..0e109ccd 100644
--- a/openpgp/examples/generate-encrypt-decrypt.rs
+++ b/openpgp/examples/generate-encrypt-decrypt.rs
@@ -115,10 +115,8 @@ impl<'a> DecryptionHelper for Helper<'a> {
-> openpgp::Result<Option<openpgp::Fingerprint>>
where D: FnMut(SymmetricAlgorithm, &SessionKey) -> openpgp::Result<()>
{
- // The encryption key is the first and only subkey.
- let key = self.secret.subkeys().nth(0)
- .map(|binding| binding.key().clone())
- .unwrap();
+ let key = self.secret.keys().policy(None)
+ .for_transport_encryption().nth(0).unwrap().key().clone();
// The secret key is not encrypted.
let mut pair = key.mark_parts_secret().unwrap().into_keypair().unwrap();