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-ffi/src/serialize.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'openpgp-ffi/src') diff --git a/openpgp-ffi/src/serialize.rs b/openpgp-ffi/src/serialize.rs index 394c3475..4669cb41 100644 --- a/openpgp-ffi/src/serialize.rs +++ b/openpgp-ffi/src/serialize.rs @@ -395,17 +395,10 @@ pub extern "C" fn pgp_encryptor_new<'a> "Neither recipient nor password given"))); } - let mut encryptor = if let Some(p) = passwords_.pop() { - Encryptor::with_password(*inner, p) - } else { - Encryptor::for_recipient(*inner, recipients_.pop().unwrap()) - }; + let mut encryptor = Encryptor::for_recipients(*inner, recipients_); for p in passwords_ { encryptor = encryptor.add_password(p); } - for r in recipients_ { - encryptor = encryptor.add_recipient(r); - } if let Some(algo) = cipher_algo { encryptor = encryptor.sym_algo(algo); } -- cgit v1.2.3