diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-08-01 16:51:38 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-08-01 16:51:38 -0400 |
commit | 582a0bccf80ad16c1b689aa5bc5bde4b5fcd5be5 (patch) | |
tree | 3a0b8404dc5af90327a86a8256c82cfcd03146de /tests/test_x509_ext.py | |
parent | 877bdf01d60fb0b56dae31e1b8a2bdad2a9f4fc2 (diff) | |
parent | 1b7500f5f91a9ad07f5f15caf17264753173f8d8 (diff) | |
download | cryptography-582a0bccf80ad16c1b689aa5bc5bde4b5fcd5be5.tar.gz cryptography-582a0bccf80ad16c1b689aa5bc5bde4b5fcd5be5.tar.bz2 cryptography-582a0bccf80ad16c1b689aa5bc5bde4b5fcd5be5.zip |
Merge pull request #2186 from reaperhulk/handle-corrupt-extensions
Handle invalid x509 extension payloads
Diffstat (limited to 'tests/test_x509_ext.py')
-rw-r--r-- | tests/test_x509_ext.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 7b135828..890709ae 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -2853,3 +2853,18 @@ class TestInhibitAnyPolicyExtension(object): x509.OID_INHIBIT_ANY_POLICY ).value assert iap.skip_certs == 5 + + +@pytest.mark.requires_backend_interface(interface=RSABackend) +@pytest.mark.requires_backend_interface(interface=X509Backend) +class TestInvalidExtension(object): + def test_invalid_certificate_policies_data(self, backend): + cert = _load_cert( + os.path.join( + "x509", "custom", "cp_invalid.pem" + ), + x509.load_pem_x509_certificate, + backend + ) + with pytest.raises(ValueError): + cert.extensions |