aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-10-10 10:07:34 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2015-10-10 10:07:34 -0400
commit8453d642da4aed6f3f151536539614db1dc743e3 (patch)
tree5b803fbee0c2534072e126884da80af1b49f7858 /src
parent96605fcd47ab4e20829a555ed5450cf99263d431 (diff)
downloadcryptography-8453d642da4aed6f3f151536539614db1dc743e3.tar.gz
cryptography-8453d642da4aed6f3f151536539614db1dc743e3.tar.bz2
cryptography-8453d642da4aed6f3f151536539614db1dc743e3.zip
handle errors
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/x509.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/x509.py b/src/cryptography/hazmat/backends/openssl/x509.py
index eefcb20f..93aea27a 100644
--- a/src/cryptography/hazmat/backends/openssl/x509.py
+++ b/src/cryptography/hazmat/backends/openssl/x509.py
@@ -261,6 +261,8 @@ class _Certificate(object):
def public_key(self):
pkey = self._backend._lib.X509_get_pubkey(self._x509)
if pkey == self._backend._ffi.NULL:
+ # Remove errors from the stack.
+ self._backend._consume_errors()
raise ValueError("Certificate public key is of an unkonwn type")
pkey = self._backend._ffi.gc(pkey, self._backend._lib.EVP_PKEY_free)