diff options
Diffstat (limited to 'openpgp/src/crypto/backend/nettle/asymmetric.rs')
-rw-r--r-- | openpgp/src/crypto/backend/nettle/asymmetric.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/openpgp/src/crypto/backend/nettle/asymmetric.rs b/openpgp/src/crypto/backend/nettle/asymmetric.rs index 54fa31d2..c96ccaf0 100644 --- a/openpgp/src/crypto/backend/nettle/asymmetric.rs +++ b/openpgp/src/crypto/backend/nettle/asymmetric.rs @@ -222,9 +222,18 @@ impl<P: key::KeyParts, R: key::KeyRole> Key<P, R> { }, } }, + ECDH => crate::crypto::ecdh::encrypt(self.parts_as_public(), data), - algo => Err(Error::UnsupportedPublicKeyAlgorithm(algo).into()), + + RSASign | DSA | ECDSA | EdDSA => + Err(Error::InvalidOperation( + format!("{} is not an encryption algorithm", self.pk_algo()) + ).into()), + + ElGamalEncrypt | ElGamalEncryptSign | + Private(_) | Unknown(_) => + Err(Error::UnsupportedPublicKeyAlgorithm(self.pk_algo()).into()), } } |