aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-03-13 13:33:06 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-03-13 13:33:06 -0500
commit81d069d3100bbdf1a612e01dfb71687ec0d84110 (patch)
treedaa6dfa76c2b908ced2247bda7bc2e2c92ee0279 /src
parent7905fcec68fd633d0b28d371660123b7b22cca53 (diff)
downloadcryptography-81d069d3100bbdf1a612e01dfb71687ec0d84110.tar.gz
cryptography-81d069d3100bbdf1a612e01dfb71687ec0d84110.tar.bz2
cryptography-81d069d3100bbdf1a612e01dfb71687ec0d84110.zip
support DER encoded EC private key serialization
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index 150dbfc0..13699558 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -1207,9 +1207,12 @@ class Backend(object):
def _private_key_bytes_traditional_der(self, type, cdata):
if type == self._lib.EVP_PKEY_RSA:
write_bio = self._lib.i2d_RSAPrivateKey_bio
+ elif (self._lib.Cryptography_HAS_EC == 1 and
+ type == self._lib.EVP_PKEY_EC):
+ write_bio = self._lib.i2d_ECPrivateKey_bio
else:
raise TypeError(
- "Only RSA keys are supported for DER serialization"
+ "Only RSA & EC keys are supported for DER serialization"
)
bio = self._create_mem_bio()