diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2015-04-30 11:13:55 -0400 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2015-04-30 11:13:55 -0400 |
commit | b1501bce9116617ab564c85592d37926c8069b87 (patch) | |
tree | b895009eeddb83753ae0d83941d1338620d54d4b /tests | |
parent | b3995a9a0708b49e0d29091420022ba5445f72c5 (diff) | |
parent | 2187a05ef1a74eeb66bad9b4525afe841d9c2624 (diff) | |
download | cryptography-b1501bce9116617ab564c85592d37926c8069b87.tar.gz cryptography-b1501bce9116617ab564c85592d37926c8069b87.tar.bz2 cryptography-b1501bce9116617ab564c85592d37926c8069b87.zip |
Merge pull request #1879 from reaperhulk/san-dirname
add support for directory name general names
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_x509_ext.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py index 5c35c970..d38fe573 100644 --- a/tests/test_x509_ext.py +++ b/tests/test_x509_ext.py @@ -831,3 +831,28 @@ class TestRSASubjectAlternativeNameExtension(object): ipaddress.ip_address(u"127.0.0.1"), ipaddress.ip_address(u"ff::") ] == ip + + def test_dirname(self, backend): + cert = _load_cert( + os.path.join( + "x509", "custom", "san_dirname.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 + + dirname = san.get_values_for_type(x509.DirectoryName) + assert [ + x509.Name([ + x509.NameAttribute(x509.OID_COMMON_NAME, 'test'), + x509.NameAttribute(x509.OID_ORGANIZATION_NAME, 'Org'), + x509.NameAttribute(x509.OID_STATE_OR_PROVINCE_NAME, 'Texas'), + ]) + ] == dirname |