From a9ca727cab50c0c91098a7ef8aea79f5f62a1f5c Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Fri, 3 Apr 2020 18:22:55 +0200 Subject: openpgp: Unawkwardify the streaming encryptor. --- openpgp/examples/pad.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'openpgp/examples/pad.rs') diff --git a/openpgp/examples/pad.rs b/openpgp/examples/pad.rs index 4a762b58..8e5915a8 100644 --- a/openpgp/examples/pad.rs +++ b/openpgp/examples/pad.rs @@ -38,7 +38,7 @@ fn main() { }).collect(); // Build a vector of recipients to hand to Encryptor. - let mut recipients = certs + let recipients = certs .iter() .flat_map(|cert| { cert.keys() @@ -57,12 +57,8 @@ fn main() { let message = Message::new(&mut sink); // We want to encrypt a literal data packet. - let mut encryptor = Encryptor::for_recipient( - message, recipients.pop().expect("No encryption key found")); - for r in recipients { - encryptor = encryptor.add_recipient(r) - } - let encryptor = encryptor.build().expect("Failed to create encryptor"); + let encryptor = Encryptor::for_recipients(message, recipients) + .build().expect("Failed to create encryptor"); let padder = Padder::new(encryptor, padme) .expect("Failed to create padder"); -- cgit v1.2.3