summaryrefslogtreecommitdiffstats
path: root/tool/src/commands
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-04-08 17:09:47 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-04-08 19:20:20 +0200
commitcb598ce96d611f68ca887d2f30352f84f642abb9 (patch)
treed16ed4a6e7500d12007bd21813f49e0f1e333524 /tool/src/commands
parentcbf8f54cb062a92aa9b3928a7b2158de5175a895 (diff)
openpgp: Replace PacketParser::decrypted with PP::encrypted.
- `decrypted` implies that the packet was previously encrypted. However, If we parse a signed-only message, the literal packet was never encrypted. Provide the inverse predicate instead, which is less misleading.
Diffstat (limited to 'tool/src/commands')
-rw-r--r--tool/src/commands/decrypt.rs2
-rw-r--r--tool/src/commands/dump.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/tool/src/commands/decrypt.rs b/tool/src/commands/decrypt.rs
index 538636fb..bff349e5 100644
--- a/tool/src/commands/decrypt.rs
+++ b/tool/src/commands/decrypt.rs
@@ -327,7 +327,7 @@ pub fn decrypt_unwrap(ctx: &Context, policy: &dyn Policy,
helper.decrypt(&pkesks[..], &skesks[..], sym_algo_hint,
decrypt)?;
}
- if ! pp.decrypted() {
+ if pp.encrypted() {
// XXX: That is not quite the right error to return.
return Err(
openpgp::Error::InvalidSessionKey(
diff --git a/tool/src/commands/dump.rs b/tool/src/commands/dump.rs
index b8573dde..a9d068ae 100644
--- a/tool/src/commands/dump.rs
+++ b/tool/src/commands/dump.rs
@@ -124,10 +124,10 @@ pub fn dump<W>(input: &mut dyn io::Read, output: &mut dyn io::Write,
let mut fields = Vec::new();
fields.push(format!("Session key: {}", hex::encode(sk)));
- if pp.decrypted() {
- fields.push("Decryption successful".into());
- } else {
+ if pp.encrypted() {
fields.push("Decryption failed".into());
+ } else {
+ fields.push("Decryption successful".into());
}
Some(fields)
},