summaryrefslogtreecommitdiffstats
path: root/openpgp/examples/pad.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/examples/pad.rs')
-rw-r--r--openpgp/examples/pad.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/openpgp/examples/pad.rs b/openpgp/examples/pad.rs
index 76d4ebc0..6a3d7c96 100644
--- a/openpgp/examples/pad.rs
+++ b/openpgp/examples/pad.rs
@@ -37,7 +37,7 @@ fn main() {
}).collect();
// Build a vector of recipients to hand to Encryptor.
- let recipients =
+ let mut recipients =
tpks.iter()
.flat_map(|tpk| tpk.keys_valid().key_flags(mode.clone()))
.map(|(_, _, key)| Recipient::new(KeyID::wildcard(), key))
@@ -53,11 +53,12 @@ fn main() {
let message = Message::new(sink);
// We want to encrypt a literal data packet.
- let encryptor = Encryptor::new(message,
- &[], // No symmetric encryption.
- &recipients,
- None, None)
- .expect("Failed to create encryptor");
+ 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 padder = Padder::new(encryptor, padme)
.expect("Failed to create padder");