diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-07-01 21:47:31 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-07-01 21:47:31 -0400 |
commit | ec3cc9bd730b6799424dc3f69b79d490eaa2f07d (patch) | |
tree | f616a48bd600d4b44e1180b81c1641a24c2693e3 /tests/test_x509_ext.py | |
parent | 246fc85526af4d5e48ca827ecb6baa3e8331f77d (diff) | |
parent | 423768361e3b5ea6a39819d512ca72ce176d151d (diff) | |
download | cryptography-ec3cc9bd730b6799424dc3f69b79d490eaa2f07d.tar.gz cryptography-ec3cc9bd730b6799424dc3f69b79d490eaa2f07d.tar.bz2 cryptography-ec3cc9bd730b6799424dc3f69b79d490eaa2f07d.zip |
Merge pull request #2094 from reaperhulk/nc-the-hard-part-again
name constraints - support leading periods
Diffstat (limited to 'tests/test_x509_ext.py')
-rw-r--r-- | tests/test_x509_ext.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 15ee118a..0ef84e79 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -2076,6 +2076,44 @@ class TestNameConstraintsExtension(object): excluded_subtrees=None ) + def test_permitted_with_leading_period(self, backend): + cert = _load_cert( + os.path.join( + "x509", "custom", "nc_permitted.pem" + ), + x509.load_pem_x509_certificate, + backend + ) + nc = cert.extensions.get_extension_for_oid( + x509.OID_NAME_CONSTRAINTS + ).value + assert nc == x509.NameConstraints( + permitted_subtrees=[ + x509.DNSName(u".cryptography.io"), + x509.UniformResourceIdentifier(u"ftp://cryptography.test") + ], + excluded_subtrees=None + ) + + def test_excluded_with_leading_period(self, backend): + cert = _load_cert( + os.path.join( + "x509", "custom", "nc_excluded.pem" + ), + x509.load_pem_x509_certificate, + backend + ) + nc = cert.extensions.get_extension_for_oid( + x509.OID_NAME_CONSTRAINTS + ).value + assert nc == x509.NameConstraints( + permitted_subtrees=None, + excluded_subtrees=[ + x509.DNSName(u".cryptography.io"), + x509.UniformResourceIdentifier(u"gopher://cryptography.test") + ] + ) + class TestDistributionPoint(object): def test_distribution_point_full_name_not_general_names(self): |