diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-06 22:36:01 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-06 23:01:29 +0100 |
commit | fc6ded10e255a2fc4423e7f360951a2f3eed5d6f (patch) | |
tree | b478c144171354bbf518a0d94d371a75139a94b4 /openpgp/src/serialize/stream.rs | |
parent | fe16487556c2b4d16400515aea8c448b0890e74c (diff) |
openpgp: Use KeyAmalgamation::for_xxx instead of building a KeyFlags
- Use the convenient functions
KeyAmalgamation::for_storage_encryption,
KeyAmalgamation::for_transport_encryption, etc., instead of
building up a KeyFlags and then calling
KeyAmalgamation::key_flags.
- This pattern requires less boilerplate.
Diffstat (limited to 'openpgp/src/serialize/stream.rs')
-rw-r--r-- | openpgp/src/serialize/stream.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs index 88c301ea..cabe130b 100644 --- a/openpgp/src/serialize/stream.rs +++ b/openpgp/src/serialize/stream.rs @@ -988,9 +988,7 @@ impl<'a> Encryptor<'a> { /// // Build a vector of recipients to hand to Encryptor. /// let recipient = /// cert.keys().policy(None).alive().revoked(false) - /// .key_flags(KeyFlags::default() - /// .set_storage_encryption(true) - /// .set_transport_encryption(true)) + /// .for_storage_encryption().for_transport_encryption() /// .map(|ka| ka.key().into()) /// .nth(0).unwrap(); /// @@ -1643,7 +1641,6 @@ mod test { use std::cmp; - use crate::types::KeyFlags; use crate::parse::{ stream::{ Decryptor, @@ -1678,8 +1675,7 @@ mod test { where D: FnMut(SymmetricAlgorithm, &SessionKey) -> Result<()> { let mut keypair = self.tsk.keys().policy(None) - .key_flags( - KeyFlags::default().set_transport_encryption(true)) + .for_transport_encryption() .map(|ka| ka.key()).next().unwrap() .clone().mark_parts_secret().unwrap() .into_keypair().unwrap(); @@ -1706,9 +1702,7 @@ mod test { let m = Message::new(&mut msg); let recipient = tsk .keys().policy(None) - .key_flags(KeyFlags::default() - .set_storage_encryption(true) - .set_transport_encryption(true)) + .for_storage_encryption().for_transport_encryption() .nth(0).unwrap().key().into(); let encryptor = Encryptor::for_recipient(m, recipient) .aead_algo(AEADAlgorithm::EAX) |