From 81d069d3100bbdf1a612e01dfb71687ec0d84110 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 13 Mar 2015 13:33:06 -0500 Subject: support DER encoded EC private key serialization --- src/cryptography/hazmat/backends/openssl/backend.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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() -- cgit v1.2.3