summaryrefslogtreecommitdiffstats
path: root/tool/src/sq.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-10-04 15:31:28 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-12-06 15:11:54 +0100
commit30b37711392468161817653211754601f4f52057 (patch)
tree4060e00c6a3a9d18ec759e95d954a77f389f7a57 /tool/src/sq.rs
parent149f252e5d1f6e30869f7981622322ab345cd2fc (diff)
tool: Add packet decrypt that unwraps encryption containers.
Diffstat (limited to 'tool/src/sq.rs')
-rw-r--r--tool/src/sq.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tool/src/sq.rs b/tool/src/sq.rs
index 055cf642..950ce27a 100644
--- a/tool/src/sq.rs
+++ b/tool/src/sq.rs
@@ -332,6 +332,28 @@ fn real_main() -> Result<(), failure::Error> {
m.is_present("mpis"), m.is_present("hex"),
session_key.as_ref(), width)?;
},
+
+ ("decrypt", Some(m)) => {
+ let mut input = open_or_stdin(m.value_of("input"))?;
+ let output = create_or_stdout(m.value_of("output"), force)?;
+ let mut output = if ! m.is_present("binary") {
+ Box::new(armor::Writer::new(output,
+ armor::Kind::Message,
+ &[])?)
+ } else {
+ output
+ };
+ let secrets = m.values_of("secret-key-file")
+ .map(load_certs)
+ .unwrap_or(Ok(vec![]))?;
+ let mut mapping = Mapping::open(&ctx, realm_name, mapping_name)
+ .context("Failed to open the mapping")?;
+ commands::decrypt::decrypt_unwrap(
+ &ctx, &mut mapping,
+ &mut input, &mut output,
+ secrets, m.is_present("dump-session-key"))?;
+ },
+
("split", Some(m)) => {
let mut input = open_or_stdin(m.value_of("input"))?;
let prefix =