From 3d7acf62b65ddb9919cbba6bd4f26fa7e94fce45 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 26 Aug 2019 16:19:47 +0200 Subject: tool: Annotate TPKs retrieved from keyservers. - See #305. --- tool/src/sq.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'tool') 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"))?; -- cgit v1.2.3