summaryrefslogtreecommitdiffstats
path: root/tool/src/sq.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tool/src/sq.rs')
-rw-r--r--tool/src/sq.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/tool/src/sq.rs b/tool/src/sq.rs
index 02350b38..c893fb4f 100644
--- a/tool/src/sq.rs
+++ b/tool/src/sq.rs
@@ -320,18 +320,13 @@ fn real_main() -> Result<(), failure::Error> {
let id = id.unwrap();
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,
- &[])?)
+ let tpk = core.run(ks.get(&id))
+ .context("Failed to retrieve key")?;
+ if ! m.is_present("binary") {
+ tpk.armored().serialize(&mut output)
} else {
- output
- };
-
- core.run(ks.get(&id))
- .context("Failed to retrieve key")?
- .serialize(&mut output)
- .context("Failed to serialize key")?;
+ tpk.serialize(&mut output)
+ }.context("Failed to serialize key")?;
},
("send", Some(m)) => {
let mut input = open_or_stdin(m.value_of("input"))?;