diff options
Diffstat (limited to 'openpgp/examples/sign-detached.rs')
-rw-r--r-- | openpgp/examples/sign-detached.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/openpgp/examples/sign-detached.rs b/openpgp/examples/sign-detached.rs index d4d8d40d..98202bd2 100644 --- a/openpgp/examples/sign-detached.rs +++ b/openpgp/examples/sign-detached.rs @@ -6,7 +6,6 @@ extern crate rpassword; extern crate sequoia_openpgp as openpgp; use crate::openpgp::armor; -use crate::openpgp::crypto; use crate::openpgp::parse::Parse; use crate::openpgp::serialize::stream::{Message, Signer}; @@ -56,12 +55,14 @@ fn main() { // Stream an OpenPGP message. let message = Message::new(sink); - // Now, create a signer that emits a detached signature. - let mut signer = Signer::detached( - message, - keys.iter_mut().map(|s| -> &mut dyn crypto::Signer<_> { s }).collect(), - None) - .expect("Failed to create signer"); + // Now, create a signer that emits the detached signature(s). + let mut signer = + Signer::new(message, keys.pop().expect("No key for signing")); + for s in keys { + signer = signer.add_signer(s); + } + let mut signer = + signer.detached().build().expect("Failed to create signer"); // Copy all the data. io::copy(&mut io::stdin(), &mut signer) |