aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-08-03 16:58:09 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2015-08-03 16:58:09 -0400
commite0277f7e4598db6628cb378ba40bec8edb6f8672 (patch)
tree15b64b0bd6bf8fa8694dd1d0eb13d157269ac4c9 /src
parentb45c79b69d75c0e1dc69e941f67c3eaa4326a443 (diff)
parent2748d8aefb765f7549869c619c9d2136c2aa2318 (diff)
downloadcryptography-e0277f7e4598db6628cb378ba40bec8edb6f8672.tar.gz
cryptography-e0277f7e4598db6628cb378ba40bec8edb6f8672.tar.bz2
cryptography-e0277f7e4598db6628cb378ba40bec8edb6f8672.zip
Merge pull request #2197 from reaperhulk/cert-ku-eku
support keyusage and extendedkeyusage in certificatebuilder
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py4
-rw-r--r--src/cryptography/x509.py4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index 0176de21..5bb91a9b 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -1137,6 +1137,10 @@ class Backend(object):
for i, extension in enumerate(builder._extensions):
if isinstance(extension.value, x509.BasicConstraints):
pp, r = _encode_basic_constraints(self, extension.value)
+ elif isinstance(extension.value, x509.KeyUsage):
+ pp, r = _encode_key_usage(self, extension.value)
+ elif isinstance(extension.value, x509.ExtendedKeyUsage):
+ pp, r = _encode_extended_key_usage(self, extension.value)
elif isinstance(extension.value, x509.SubjectAlternativeName):
pp, r = _encode_subject_alt_name(self, extension.value)
else:
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py
index f35582b0..defac248 100644
--- a/src/cryptography/x509.py
+++ b/src/cryptography/x509.py
@@ -1720,6 +1720,10 @@ class CertificateBuilder(object):
"""
if isinstance(extension, BasicConstraints):
extension = Extension(OID_BASIC_CONSTRAINTS, critical, extension)
+ elif isinstance(extension, KeyUsage):
+ extension = Extension(OID_KEY_USAGE, critical, extension)
+ elif isinstance(extension, ExtendedKeyUsage):
+ extension = Extension(OID_EXTENDED_KEY_USAGE, critical, extension)
elif isinstance(extension, SubjectAlternativeName):
extension = Extension(
OID_SUBJECT_ALTERNATIVE_NAME, critical, extension