summaryrefslogtreecommitdiffstats
path: root/autocrypt
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 /autocrypt
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 'autocrypt')
-rw-r--r--autocrypt/src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/autocrypt/src/lib.rs b/autocrypt/src/lib.rs
index 7a1a571a..9187d1d3 100644
--- a/autocrypt/src/lib.rs
+++ b/autocrypt/src/lib.rs
@@ -652,7 +652,7 @@ impl<'a> AutocryptSetupMessageParser<'a> {
/// `AutocryptSetupMessageParser::parse()` to extract the
/// `AutocryptSetupMessage`.
pub fn decrypt(&mut self, passcode: &Password) -> Result<()> {
- if self.pp.decrypted() {
+ if ! self.pp.encrypted() {
return Err(
Error::InvalidOperation("Already decrypted".into()).into());
}
@@ -676,7 +676,7 @@ impl<'a> AutocryptSetupMessageParser<'a> {
/// If the payload is malformed, returns
/// `Error::MalformedMessage`.
pub fn parse(self) -> Result<AutocryptSetupMessage> {
- if !self.pp.decrypted() {
+ if self.pp.encrypted() {
return Err(
Error::InvalidOperation("Not decrypted".into()).into());
}