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 /guide/src/chapter_02.md | |
parent | 94c64d7a831227888c2ab6b5fe9ec0c29781caec (diff) |
openpgp: Use Cert::keys instead of Cert::subkeys.
Diffstat (limited to 'guide/src/chapter_02.md')
-rw-r--r-- | guide/src/chapter_02.md | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/guide/src/chapter_02.md b/guide/src/chapter_02.md index c9c22961..697f93cf 100644 --- a/guide/src/chapter_02.md +++ b/guide/src/chapter_02.md @@ -125,9 +125,8 @@ fn main() { # 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(); @@ -266,9 +265,8 @@ fn generate() -> openpgp::Result<openpgp::Cert> { # 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(); @@ -407,9 +405,8 @@ fn encrypt(sink: &mut Write, plaintext: &str, recipient: &openpgp::Cert) # 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(); @@ -561,10 +558,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(); |