summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-09-10 14:20:50 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-09-10 15:06:35 +0200
commitd4e5e6c48aadd01fc3a96917f36d3ec9649639b6 (patch)
treed5d59205dfbd548aa91d0f99b7e1a1a5da1e659e /tool
parentabc14eb1fabc3c85d74ed93ea7779f12201c4219 (diff)
openpgp: Make password argument polymorphic.
Diffstat (limited to 'tool')
-rw-r--r--tool/src/commands/mod.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/tool/src/commands/mod.rs b/tool/src/commands/mod.rs
index 7ba0aab0..44173e04 100644
--- a/tool/src/commands/mod.rs
+++ b/tool/src/commands/mod.rs
@@ -94,7 +94,7 @@ pub fn encrypt(store: &mut store::Store,
for r in recipients {
tpks.push(store.lookup(r).context("No such key found")?.tpk()?);
}
- let mut passwords = Vec::with_capacity(npasswords);
+ let mut passwords: Vec<crypto::Password> = Vec::with_capacity(npasswords);
for n in 0..npasswords {
let nprompt = format!("Enter password {}: ", n + 1);
passwords.push(rpassword::read_password_from_tty(Some(
@@ -124,15 +124,12 @@ pub fn encrypt(store: &mut store::Store,
}
}
- let passwords_: Vec<&openpgp::crypto::Password> =
- passwords.iter().collect();
-
// Stream an OpenPGP message.
let message = Message::new(output);
// We want to encrypt a literal data packet.
let mut sink = Encryptor::new(message,
- &passwords_,
+ passwords,
recipient_subkeys,
None, None)
.context("Failed to create encryptor")?;