diff options
Diffstat (limited to 'guide')
-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(); |