summaryrefslogtreecommitdiffstats
path: root/openpgp/examples/decrypt-with.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-11-26 22:56:40 +0100
committerJustus Winter <justus@sequoia-pgp.org>2018-11-26 23:18:45 +0100
commit02f4973085e15c944c85231fa49605ac33c8f4b7 (patch)
tree6d64fbdd3ea6a870f1321e07c006859071291645 /openpgp/examples/decrypt-with.rs
parentb08498fae6c3bd87fd3c2b3bcadac0dd10d3d351 (diff)
openpgp: Update examples.
- The packet parser transparently strips armor now.
Diffstat (limited to 'openpgp/examples/decrypt-with.rs')
-rw-r--r--openpgp/examples/decrypt-with.rs13
1 files changed, 2 insertions, 11 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs
index 6ac419ed..84f333db 100644
--- a/openpgp/examples/decrypt-with.rs
+++ b/openpgp/examples/decrypt-with.rs
@@ -22,22 +22,13 @@ pub fn main() {
// Read the transferable secret keys from the given files.
let tpks =
args[1..].iter().map(|f| {
- openpgp::TPK::from_reader(
- // Use an openpgp::Reader so that we accept both armored
- // and plain PGP data.
- openpgp::Reader::from_file(f)
- .expect("Failed to open file"))
+ openpgp::TPK::from_file(f)
.expect("Failed to read key")
}).collect();
- // First, use an openpgp::Reader so that we accept both armored
- // and plain PGP data.
- let reader = openpgp::Reader::from_reader(io::stdin())
- .expect("Failed to open file");
-
// Now, create a decryptor with a helper using the given TPKs.
let mut decryptor =
- Decryptor::from_reader(reader, Helper::new(tpks)).unwrap();
+ Decryptor::from_reader(io::stdin(), Helper::new(tpks)).unwrap();
// Finally, stream the decrypted data to stdout.
io::copy(&mut decryptor, &mut io::stdout())