diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2018-06-28 10:08:06 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2018-06-28 10:18:10 +0200 |
commit | f1df1c35db9a437a61c0c09ab2bed162f8102675 (patch) | |
tree | a0cf1561ace2cc3b5dd4cba8d86183a4a7037654 | |
parent | 1f1d83d5687a7e2ff21f250117e6f5256fcc38e6 (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.rs | 10 |
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()), } } } |