aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_x509_ext.py
diff options
context:
space:
mode:
authorJoshua Tauberer <jt@occams.info>2015-07-04 20:09:46 +0000
committerJoshua Tauberer <jt@occams.info>2015-07-06 23:01:22 +0000
commit2ee5e3c6240721120146d6d81c70e1b900029ee0 (patch)
tree1649fac07c5b6cd18a16ce86ca5f33a9cd27cf95 /tests/test_x509_ext.py
parent0784a23d4ab15e98214ccdf07021d42568404c1c (diff)
downloadcryptography-2ee5e3c6240721120146d6d81c70e1b900029ee0.tar.gz
cryptography-2ee5e3c6240721120146d6d81c70e1b900029ee0.tar.bz2
cryptography-2ee5e3c6240721120146d6d81c70e1b900029ee0.zip
parse SAN otherNames into OtherName instances rather than raising an exception
Test added.
Diffstat (limited to 'tests/test_x509_ext.py')
-rw-r--r--tests/test_x509_ext.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index d15d6669..06adaa37 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -1578,6 +1578,30 @@ class TestRSASubjectAlternativeNameExtension(object):
assert 'Invalid rfc822name value' in str(exc.value)
+ def test_other_name(self, backend):
+ cert = _load_cert(
+ os.path.join(
+ "x509", "custom", "san_other_name.pem"
+ ),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+
+ ext = cert.extensions.get_extension_for_oid(
+ x509.OID_SUBJECT_ALTERNATIVE_NAME
+ )
+ assert ext is not None
+ assert ext.critical is False
+
+ assert len(ext.value) == 1
+ assert list(ext.value)[0] == \
+ x509.OtherName(
+ x509.ObjectIdentifier("1.2.3.4"),
+ b'\x16\x0bHello World')
+
+ othernames = ext.value.get_values_for_type(x509.OtherName)
+ assert othernames == [b'\x16\x0bHello World']
+
@pytest.mark.requires_backend_interface(interface=RSABackend)
@pytest.mark.requires_backend_interface(interface=X509Backend)