aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorunknown <mrh2@MRH2W7D.uk.cambridgeconsultants.com>2014-09-11 18:27:56 +0100
committerunknown <mrh2@MRH2W7D.uk.cambridgeconsultants.com>2014-09-11 18:27:56 +0100
commit04e783f5610d3983bb3cbdf82720d17a97c779a7 (patch)
tree3e34507f87081a5e9cc06f2c1229f2f0858f822d /cryptography
parentb8599c085d3e295f460f0117f7df9288a4841d7f (diff)
downloadcryptography-04e783f5610d3983bb3cbdf82720d17a97c779a7.tar.gz
cryptography-04e783f5610d3983bb3cbdf82720d17a97c779a7.tar.bz2
cryptography-04e783f5610d3983bb3cbdf82720d17a97c779a7.zip
Implemented support for loading EC private keys
Loads Elliptic Curve private keys from .PEM files, whether encrypted or unencrypted, given that the encryption method is supported. Also included changes to the test files and documentation for said method.
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index d1d18a10..b59b2391 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -473,6 +473,11 @@ class Backend(object):
assert dsa_cdata != self._ffi.NULL
dsa_cdata = self._ffi.gc(dsa_cdata, self._lib.DSA_free)
return _DSAPrivateKey(self, dsa_cdata)
+ elif type == self._lib.EVP_PKEY_EC:
+ ec_cdata = self._lib.EVP_PKEY_get1_EC_KEY(evp_pkey)
+ assert ec_cdata != self._ffi.NULL
+ ec_cdata = self._ffi.gc(ec_cdata, self._lib.EC_KEY_free)
+ return _EllipticCurvePrivateKey(self, ec_cdata, None)
else:
raise UnsupportedAlgorithm("Unsupported key type.")