diff options
author | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2021-03-24 11:44:05 +0100 |
---|---|---|
committer | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2021-03-24 11:44:05 +0100 |
commit | d0cbaee3be5fdf7327929fe8439491dd520a784e (patch) | |
tree | 3a2b79103cf5edb4c78484ab132c8542e66d8d25 | |
parent | ac992b942e57fb68131a72d238c188e30f306941 (diff) |
ipc: Fix armoring in the gpg-agent-sign example.
- Previously the armor::Writer was used but this caused the armoring
not to be finalized and the output to appear truncated.
- Migrate to Armorer to fix the resulting output.
-rw-r--r-- | ipc/examples/gpg-agent-sign.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ipc/examples/gpg-agent-sign.rs b/ipc/examples/gpg-agent-sign.rs index d65df8a1..1b474ca5 100644 --- a/ipc/examples/gpg-agent-sign.rs +++ b/ipc/examples/gpg-agent-sign.rs @@ -6,9 +6,8 @@ use clap; use sequoia_openpgp as openpgp; use sequoia_ipc as ipc; -use crate::openpgp::armor; use crate::openpgp::parse::Parse; -use crate::openpgp::serialize::stream::{Message, LiteralWriter, Signer}; +use crate::openpgp::serialize::stream::{Armorer, Message, LiteralWriter, Signer}; use crate::openpgp::policy::StandardPolicy as P; use crate::ipc::gnupg::{Context, KeyPair}; @@ -49,13 +48,14 @@ fn main() { }).collect::<Vec<KeyPair>>(); // Compose a writer stack corresponding to the output format and - // packet structure we want. First, we want the output to be - // ASCII armored. - let sink = armor::Writer::new(io::stdout(), armor::Kind::Message) - .expect("Failed to create an armored writer."); + // packet structure we want. // Stream an OpenPGP message. - let message = Message::new(sink); + let message = Message::new(io::stdout()); + + // We want the output to be ASCII armored. + let message = Armorer::new(message).build() + .expect("Failed to create the armorer."); // Now, create a signer that emits the signature(s). let mut signer = |