summaryrefslogtreecommitdiff
path: root/src/OpenSSL/crypto.py
diff options
context:
space:
mode:
authorwhiteowl3 <71030468+whiteowl3@users.noreply.github.com>2022-02-26 17:45:36 -0500
committerGitHub <noreply@github.com>2022-02-26 17:45:36 -0500
commit7bd0df4f60a9fb919985e1375ddf289ccb42fbe8 (patch)
tree5eec0c7fde2ca99f8744d0922014c07c90071e8d /src/OpenSSL/crypto.py
parentdb9aed3e0d582f9d7638b0982c323b67ae2fa646 (diff)
downloadpyopenssl-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/crypto.py')
-rw-r--r--src/OpenSSL/crypto.py13
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)