diff options
Diffstat (limited to 'openpgp/src/crypto/backend/cng/asymmetric.rs')
-rw-r--r-- | openpgp/src/crypto/backend/cng/asymmetric.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/openpgp/src/crypto/backend/cng/asymmetric.rs b/openpgp/src/crypto/backend/cng/asymmetric.rs index 1eb110af..3b541e55 100644 --- a/openpgp/src/crypto/backend/cng/asymmetric.rs +++ b/openpgp/src/crypto/backend/cng/asymmetric.rs @@ -411,8 +411,17 @@ 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()), } } |