summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-09-07 17:27:45 +0200
committerJustus Winter <justus@sequoia-pgp.org>2018-09-07 17:27:45 +0200
commit7bac8e4fed5eccbdc04f48ef5d946c5da2613ec4 (patch)
treee441683a4997b232004e73111c4fe9bc826ee1a0
parentb652a98dc0f2cb26e79a6628d52e5b4f1f408d3b (diff)
openpgp: Fix last commit.
- Also check for passwords.
-rw-r--r--openpgp/src/serialize/stream.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs
index 61d61a0e..0c4192f7 100644
--- a/openpgp/src/serialize/stream.rs
+++ b/openpgp/src/serialize/stream.rs
@@ -856,9 +856,9 @@ impl<'a> Encryptor<'a> {
let mut sk = vec![0; algo.key_size().unwrap()];
rng.random(&mut sk);
- if tpks.len() == 0 {
+ if tpks.len() + passwords.len() == 0 {
return Err(Error::InvalidArgument(
- "No recipient keys given".into()).into());
+ "Neither recipient keys nor passwords given".into()).into());
}
// Write the PKESK packet(s).