From a72ebaf84b9f41dcd9535ce9481ecc1966a7a930 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Wed, 1 Jul 2015 21:07:37 -0500 Subject: simplify and handle /32 and /128 --- tests/test_x509_ext.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 7a7e79e6..af0ffafb 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -2206,6 +2206,25 @@ class TestNameConstraintsExtension(object): ] ) + def test_single_ip_netmask(self, backend): + cert = _load_cert( + os.path.join( + "x509", "custom", "nc_single_ip_netmask.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.IPAddress(ipaddress.IPv6Network(u"FF:0:0:0:0:0:0:0/128")), + x509.IPAddress(ipaddress.IPv4Network(u"192.168.0.1/32")), + ], + excluded_subtrees=None + ) + def test_invalid_netmask(self, backend): cert = _load_cert( os.path.join( -- cgit v1.2.3