aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorvicente.fiebig <vicente.fiebig@corp.globo.com>2015-10-01 18:24:58 -0300
committervicente.fiebig <vicente.fiebig@corp.globo.com>2015-10-01 18:24:58 -0300
commit6b55c4e42125dd9a01aaf83aa39b1fabfdcfa0b4 (patch)
tree0a73c081dea4687f29d709e84bbe5f2c0e3a9c9d /tests
parent415889a7eb0c47415236a80b3e71f5415401f579 (diff)
downloadcryptography-6b55c4e42125dd9a01aaf83aa39b1fabfdcfa0b4.tar.gz
cryptography-6b55c4e42125dd9a01aaf83aa39b1fabfdcfa0b4.tar.bz2
cryptography-6b55c4e42125dd9a01aaf83aa39b1fabfdcfa0b4.zip
test build ca request with path_length None
Diffstat (limited to 'tests')
-rw-r--r--tests/test_x509.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py
index 220e71a5..0c022df1 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -1601,6 +1601,30 @@ class TestCertificateBuilder(object):
decipher_only=False
)
+ @pytest.mark.requires_backend_interface(interface=RSABackend)
+ @pytest.mark.requires_backend_interface(interface=X509Backend)
+ def test_build_ca_request_with_path_length_none(self, backend):
+ private_key = RSA_KEY_2048.private_key(backend)
+
+ request = x509.CertificateSigningRequestBuilder().subject_name(
+ x509.Name([
+ x509.NameAttribute(NameOID.ORGANIZATION_NAME,
+ u'PyCA'),
+ ])
+ ).add_extension(
+ x509.BasicConstraints(ca=True, path_length=None), critical=True
+ ).sign(private_key, hashes.SHA1(), backend)
+
+ loaded_request = x509.load_pem_x509_csr(
+ request.public_bytes(encoding=serialization.Encoding.PEM), backend
+ )
+ subject = loaded_request.subject
+ assert isinstance(subject, x509.Name)
+ basic_constraints = request.extensions.get_extension_for_oid(
+ ExtensionOID.BASIC_CONSTRAINTS
+ )
+ assert basic_constraints.value.path_length is None
+
@pytest.mark.requires_backend_interface(interface=X509Backend)
class TestCertificateSigningRequestBuilder(object):