aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-10-11 11:51:27 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-10-11 11:51:27 -0500
commit9c9910da3f6cef20289d928128f5a1cb71b5e9af (patch)
tree131e6c3c9e5729074d994a9c9afb4222ae37b8a1 /tests
parent1ec38f6c1ca84014646d760754482ad7467f5b17 (diff)
parent66619382e640425c0547acee37b26376ce01e18a (diff)
downloadcryptography-9c9910da3f6cef20289d928128f5a1cb71b5e9af.tar.gz
cryptography-9c9910da3f6cef20289d928128f5a1cb71b5e9af.tar.bz2
cryptography-9c9910da3f6cef20289d928128f5a1cb71b5e9af.zip
Merge pull request #2402 from ddcc/patch-1
minor fix to handle malformed certificates without hostname
Diffstat (limited to 'tests')
-rw-r--r--tests/test_x509_ext.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index 85373973..1bc14620 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -1555,6 +1555,21 @@ class TestRSASubjectAlternativeNameExtension(object):
u'saseliminator.com'
]
+ def test_san_empty_hostname(self, backend):
+ cert = _load_cert(
+ os.path.join(
+ "x509", "custom", "san_empty_hostname.pem"
+ ),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ san = cert.extensions.get_extension_for_oid(
+ ExtensionOID.SUBJECT_ALTERNATIVE_NAME
+ )
+
+ dns = san.value.get_values_for_type(x509.DNSName)
+ assert dns == [u'']
+
def test_san_wildcard_idna_dns_name(self, backend):
cert = _load_cert(
os.path.join("x509", "custom", "san_wildcard_idna.pem"),
@@ -2903,6 +2918,30 @@ class TestCRLDistributionPointsExtension(object):
)
])
+ def test_crl_empty_hostname(self, backend):
+ cert = _load_cert(
+ os.path.join(
+ "x509", "custom", "cdp_empty_hostname.pem"
+ ),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+
+ cdps = cert.extensions.get_extension_for_oid(
+ ExtensionOID.CRL_DISTRIBUTION_POINTS
+ ).value
+
+ assert cdps == x509.CRLDistributionPoints([
+ x509.DistributionPoint(
+ full_name=[x509.UniformResourceIdentifier(
+ u"ldap:/CN=A,OU=B,dc=C,DC=D?E?F?G?H=I"
+ )],
+ relative_name=None,
+ reasons=None,
+ crl_issuer=None
+ )
+ ])
+
@pytest.mark.requires_backend_interface(interface=RSABackend)
@pytest.mark.requires_backend_interface(interface=X509Backend)