aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-05-02 22:52:57 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2015-05-02 22:52:57 -0400
commit04ee495f2b8c9d0d4f9d0a5462901feeeb7eba0c (patch)
treea7704c790cef3d0f0346b198e4cf50ad06782fc5 /tests
parentfdec095ab21e523e8de7d46d07c55c94a11960e7 (diff)
parente94f0fdf6ec8f9860d2e8d04aa31a4e0d879d2cc (diff)
downloadcryptography-04ee495f2b8c9d0d4f9d0a5462901feeeb7eba0c.tar.gz
cryptography-04ee495f2b8c9d0d4f9d0a5462901feeeb7eba0c.tar.bz2
cryptography-04ee495f2b8c9d0d4f9d0a5462901feeeb7eba0c.zip
Merge pull request #1891 from reaperhulk/x509-ossl-eku
Extended key usage support for the openssl backend
Diffstat (limited to 'tests')
-rw-r--r--tests/test_x509_ext.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_x509_ext.py b/tests/test_x509_ext.py
index 05734b42..92e616e1 100644
--- a/tests/test_x509_ext.py
+++ b/tests/test_x509_ext.py
@@ -959,3 +959,32 @@ class TestRSASubjectAlternativeNameExtension(object):
cert.extensions
assert 'Invalid rfc822name value' in str(exc.value)
+
+
+@pytest.mark.requires_backend_interface(interface=RSABackend)
+@pytest.mark.requires_backend_interface(interface=X509Backend)
+class TestExtendedKeyUsageExtension(object):
+ def test_eku(self, backend):
+ cert = _load_cert(
+ os.path.join(
+ "x509", "custom", "extended_key_usage.pem"
+ ),
+ x509.load_pem_x509_certificate,
+ backend
+ )
+ ext = cert.extensions.get_extension_for_oid(
+ x509.OID_EXTENDED_KEY_USAGE
+ )
+ assert ext is not None
+ assert ext.critical is False
+
+ assert [
+ x509.ObjectIdentifier("1.3.6.1.5.5.7.3.1"),
+ x509.ObjectIdentifier("1.3.6.1.5.5.7.3.2"),
+ x509.ObjectIdentifier("1.3.6.1.5.5.7.3.3"),
+ x509.ObjectIdentifier("1.3.6.1.5.5.7.3.4"),
+ x509.ObjectIdentifier("1.3.6.1.5.5.7.3.9"),
+ x509.ObjectIdentifier("1.3.6.1.5.5.7.3.8"),
+ x509.ObjectIdentifier("2.5.29.37.0"),
+ x509.ObjectIdentifier("2.16.840.1.113730.4.1"),
+ ] == list(ext.value)