diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-01-15 17:52:00 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-01-18 14:24:48 +0100 |
commit | 6bf3deb539ac91bba56efa57127c6c0567cf161c (patch) | |
tree | a94628796020071e2210b9c6a8d5c57b067e696e /openpgp/examples | |
parent | 94c64d7a831227888c2ab6b5fe9ec0c29781caec (diff) |
openpgp: Use Cert::keys instead of Cert::subkeys.
Diffstat (limited to 'openpgp/examples')
-rw-r--r-- | openpgp/examples/generate-encrypt-decrypt.rs | 6 |
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(); |