diff options
author | juga <juga@sequoia-pgp.org> | 2019-06-01 17:57:47 +0000 |
---|---|---|
committer | juga <juga@sequoia-pgp.org> | 2019-06-11 16:38:42 +0000 |
commit | 56909bc5786142bf59e8d1870c286d943e764a61 (patch) | |
tree | 1c4faa9dc28cf9ebaaa936951312a8145d8a3a94 /tool | |
parent | 023dda8b13aa159afc697a5afa7f2a684ec7de70 (diff) |
tool: Add headers to exported enarmored TPKs
Closes #213.
Diffstat (limited to 'tool')
-rw-r--r-- | tool/src/sq.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/tool/src/sq.rs b/tool/src/sq.rs index 8b90e936..9a611530 100644 --- a/tool/src/sq.rs +++ b/tool/src/sq.rs @@ -26,6 +26,7 @@ use openpgp::{armor, autocrypt, Fingerprint, TPK}; use openpgp::conversions::hex; use openpgp::parse::Parse; use openpgp::serialize::Serialize; +use openpgp::tpk::armor::Encoder; use sequoia_core::{Context, NetworkPolicy}; use sequoia_net::{KeyServer, wkd}; use sequoia_store::{Store, LogIter}; @@ -362,17 +363,12 @@ fn real_main() -> Result<(), failure::Error> { }, ("export", Some(m)) => { let tpk = store.lookup(m.value_of("label").unwrap())?.tpk()?; - let mut output = create_or_stdout(m.value_of("output"), force)?; - let mut output = if ! m.is_present("binary") { - Box::new(armor::Writer::new(&mut output, - armor::Kind::PublicKey, - &[])?) + if m.is_present("binary") { + tpk.serialize(&mut output)?; } else { - output - }; - - tpk.serialize(&mut output)?; + Encoder::new(&tpk).serialize(&mut output)?; + } }, ("delete", Some(m)) => { if m.is_present("label") == m.is_present("the-store") { |