diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-10-10 09:03:07 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-10-10 09:03:07 -0400 |
commit | 96605fcd47ab4e20829a555ed5450cf99263d431 (patch) | |
tree | 5bdff61f07af872bdef02cc872728237b635d808 /src | |
parent | 8e69350d8ad92a6153de27ba2eb2739bc113716f (diff) | |
download | cryptography-96605fcd47ab4e20829a555ed5450cf99263d431.tar.gz cryptography-96605fcd47ab4e20829a555ed5450cf99263d431.tar.bz2 cryptography-96605fcd47ab4e20829a555ed5450cf99263d431.zip |
Fixed #2404 -- handle a certificate with an unknown public key
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/hazmat/backends/openssl/x509.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py index 80f32e29..eefcb20f 100644 --- a/src/cryptography/hazmat/backends/openssl/x509.py +++ b/src/cryptography/hazmat/backends/openssl/x509.py @@ -260,7 +260,9 @@ class _Certificate(object): def public_key(self): pkey = self._backend._lib.X509_get_pubkey(self._x509) - self._backend.openssl_assert(pkey != self._backend._ffi.NULL) + if pkey == self._backend._ffi.NULL: + raise ValueError("Certificate public key is of an unkonwn type") + pkey = self._backend._ffi.gc(pkey, self._backend._lib.EVP_PKEY_free) return self._backend._evp_pkey_to_public_key(pkey) |