diff options
author | whiteowl3 <71030468+whiteowl3@users.noreply.github.com> | 2022-02-26 17:45:36 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-26 17:45:36 -0500 |
commit | 7bd0df4f60a9fb919985e1375ddf289ccb42fbe8 (patch) | |
tree | 5eec0c7fde2ca99f8744d0922014c07c90071e8d /src/OpenSSL | |
parent | db9aed3e0d582f9d7638b0982c323b67ae2fa646 (diff) | |
download | pyopenssl-git-7bd0df4f60a9fb919985e1375ddf289ccb42fbe8.tar.gz |
don't block ec/ed keys from_cryptography_key() (#1096)
* don't block ec/ed keys from_cryptography_key()
* clean up test comments
* properly describe test
Diffstat (limited to 'src/OpenSSL')
-rw-r--r-- | src/OpenSSL/crypto.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/OpenSSL/crypto.py b/src/OpenSSL/crypto.py index 5a54bc9..79f7f4b 100644 --- a/src/OpenSSL/crypto.py +++ b/src/OpenSSL/crypto.py @@ -5,7 +5,13 @@ import functools from functools import partial from cryptography import utils, x509 -from cryptography.hazmat.primitives.asymmetric import dsa, rsa +from cryptography.hazmat.primitives.asymmetric import ( + dsa, + ec, + ed25519, + ed448, + rsa, +) from OpenSSL._util import ( ffi as _ffi, @@ -254,6 +260,9 @@ class PKey: rsa.RSAPrivateKey, dsa.DSAPublicKey, dsa.DSAPrivateKey, + ec.EllipticCurvePrivateKey, + ed25519.Ed25519PrivateKey, + ed448.Ed448PrivateKey, ), ): raise TypeError("Unsupported key type") @@ -351,7 +360,7 @@ class PKey: raise TypeError("public key only") if _lib.EVP_PKEY_type(self.type()) != _lib.EVP_PKEY_RSA: - raise TypeError("key type unsupported") + raise TypeError("Only RSA keys can currently be checked.") rsa = _lib.EVP_PKEY_get1_RSA(self._pkey) rsa = _ffi.gc(rsa, _lib.RSA_free) |