aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Cordasco <ian.cordasco@rackspace.com>2015-06-17 11:49:11 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2015-06-24 13:35:50 -0500
commit41f51ce4690472ae930ccffd1a0b9e198945aa84 (patch)
treeb4237c5fd30726e61499c8286eed1701ee65029f /src
parent94b34d3dd621074bc4d15cdaa548b230886f5d57 (diff)
downloadcryptography-41f51ce4690472ae930ccffd1a0b9e198945aa84.tar.gz
cryptography-41f51ce4690472ae930ccffd1a0b9e198945aa84.tar.bz2
cryptography-41f51ce4690472ae930ccffd1a0b9e198945aa84.zip
Update CSR tests and implementation
- Use keyword arguments for x509.BasicConstraints in tests (missed in b790edbdc8fb9a026353d6fb99994326197705c7). - Place X509_request garbage collection under assertion. - Assert that X509 extensions created are not null. - Don't copy the extensions list in CertificateSigningBuilder. They're never appended to, so copying isn't necessary. - Use RSA key fixtures instead of generating new ones on each test run
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py3
-rw-r--r--src/cryptography/x509.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index 1861d182..406117b9 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -817,8 +817,8 @@ class Backend(object):
# Create an empty request.
x509_req = self._lib.X509_REQ_new()
- x509_req = self._ffi.gc(x509_req, self._lib.X509_REQ_free)
assert x509_req != self._ffi.NULL
+ x509_req = self._ffi.gc(x509_req, self._lib.X509_REQ_free)
# Set x509 version.
res = self._lib.X509_REQ_set_version(x509_req, x509.Version.v1.value)
@@ -839,6 +839,7 @@ class Backend(object):
# Add extensions.
extensions = self._lib.sk_X509_EXTENSION_new_null()
+ assert extensions != self._ffi.NULL
extensions = self._ffi.gc(
extensions,
self._lib.sk_X509_EXTENSION_free,
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index ab4f3c7e..7e1e34e2 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -1450,7 +1450,7 @@ class CertificateSigningRequestBuilder(object):
Creates an empty X.509 certificate request (v1).
"""
self._subject_name = subject_name
- self._extensions = extensions[:]
+ self._extensions = extensions
def subject_name(self, name):
"""