summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-06-28 10:08:06 +0200
committerJustus Winter <justus@sequoia-pgp.org>2018-06-28 10:18:10 +0200
commitf1df1c35db9a437a61c0c09ab2bed162f8102675 (patch)
treea0cf1561ace2cc3b5dd4cba8d86183a4a7037654
parent1f1d83d5687a7e2ff21f250117e6f5256fcc38e6 (diff)
openpgp: Improve error handling.
- Return an Error::InvalidArgument when trying to parse a ciphertext with a signature algorithm specifier, or a signature with an encryption one.
-rw-r--r--openpgp/src/parse/mpis.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/openpgp/src/parse/mpis.rs b/openpgp/src/parse/mpis.rs
index 99311dc7..ac17525d 100644
--- a/openpgp/src/parse/mpis.rs
+++ b/openpgp/src/parse/mpis.rs
@@ -339,9 +339,8 @@ impl MPIs {
})
}
- RSASign | DSA | EdDSA | ECDSA => {
- Err(Error::UnknownPublicKeyAlgorithm(algo).into())
- }
+ RSASign | DSA | EdDSA | ECDSA => Err(Error::InvalidArgument(
+ format!("not an encryption algorithm: {:?}", algo)).into()),
}
}
@@ -438,9 +437,8 @@ impl MPIs {
})
}
- RSAEncrypt | ElgamalEncrypt | ECDH => {
- Err(Error::UnknownPublicKeyAlgorithm(algo).into())
- }
+ RSAEncrypt | ElgamalEncrypt | ECDH => Err(Error::InvalidArgument(
+ format!("not a signature algorithm: {:?}", algo)).into()),
}
}
}