diff options
author | Nick Bastin <nick.bastin@gmail.com> | 2015-12-13 15:43:46 -0800 |
---|---|---|
committer | Nick Bastin <nick.bastin@gmail.com> | 2015-12-20 08:18:26 -0800 |
commit | 79d9e6aa93b4cc0ccdf120d48d854a09df21f381 (patch) | |
tree | 0fd2033b1d6bacb216a868fcb1a74a42284315ec /tests | |
parent | d2ecf8601bf9f6aeebd0b7080071a42ef1105cae (diff) | |
download | cryptography-79d9e6aa93b4cc0ccdf120d48d854a09df21f381.tar.gz cryptography-79d9e6aa93b4cc0ccdf120d48d854a09df21f381.tar.bz2 cryptography-79d9e6aa93b4cc0ccdf120d48d854a09df21f381.zip |
Test for non-standard AIA support in CertificateBuilder
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_x509.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_x509.py b/tests/test_x509.py index 67066f04..6c838162 100644 --- a/tests/test_x509.py +++ b/tests/test_x509.py @@ -1293,6 +1293,38 @@ class TestCertificateBuilder(object): with pytest.raises(NotImplementedError): builder.sign(private_key, hashes.SHA1(), backend) + + @pytest.mark.requires_backend_interface(interface=RSABackend) + @pytest.mark.requires_backend_interface(interface=X509Backend) + def test_encode_nonstandard_aia(self, backend): + private_key = RSA_KEY_2048.private_key(backend) + + aia = x509.AuthorityInformationAccess([ + x509.AccessDescription( + x509.ObjectIdentifier("2.999.7"), + x509.UniformResourceIdentifier(u"http://example.com") + ), + ]) + + builder = x509.CertificateBuilder().subject_name(x509.Name([ + x509.NameAttribute(NameOID.COUNTRY_NAME, u'US'), + ])).issuer_name(x509.Name([ + x509.NameAttribute(NameOID.COUNTRY_NAME, u'US'), + ])).public_key( + private_key.public_key() + ).serial_number( + 777 + ).not_valid_before( + datetime.datetime(1999, 1, 1) + ).not_valid_after( + datetime.datetime(2020, 1, 1) + ).add_extension( + aia, False + ) + + builder.sign(private_key, hashes.SHA256(), backend) + + @pytest.mark.requires_backend_interface(interface=RSABackend) @pytest.mark.requires_backend_interface(interface=X509Backend) def test_no_subject_name(self, backend): |