aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2015-04-28 08:33:18 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2015-04-30 08:10:51 -0500
commita5f030cebb43d5b378c67d72bc8a0474d1ea846e (patch)
treef18b17e61716cc5e8b0f2a860647cb63a94216bd /tests
parenta3527ac922e9b75c0fe6c229ca5c2b1c38910abd (diff)
downloadcryptography-a5f030cebb43d5b378c67d72bc8a0474d1ea846e.tar.gz
cryptography-a5f030cebb43d5b378c67d72bc8a0474d1ea846e.tar.bz2
cryptography-a5f030cebb43d5b378c67d72bc8a0474d1ea846e.zip
add support for ipaddress to general name parsing
Diffstat (limited to 'tests')
-rw-r--r--tests/test_x509_ext.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index 881dfbfa..5c35c970 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -809,3 +809,25 @@ class TestRSASubjectAlternativeNameExtension(object):
u"lo",
u"http://someregulardomain.com",
]
+
+ def test_ipaddress(self, backend):
+ cert = _load_cert(
+ os.path.join(
+ "x509", "custom", "san_ipaddr.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
+
+ san = ext.value
+
+ ip = san.get_values_for_type(x509.IPAddress)
+ assert [
+ ipaddress.ip_address(u"127.0.0.1"),
+ ipaddress.ip_address(u"ff::")
+ ] == ip