diff options
author | Andre Caron <andre.l.caron@gmail.com> | 2015-06-06 20:04:44 -0400 |
---|---|---|
committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2015-06-24 13:35:49 -0500 |
commit | 472fd6991e05735e00fdca7fbe2573a44fdabd17 (patch) | |
tree | 69b03b302645f3ca7e24306cb67a392dabbbaded /src | |
parent | d259ee51abae5a35e34f16ad74bfb1c62aa433d7 (diff) | |
download | cryptography-472fd6991e05735e00fdca7fbe2573a44fdabd17.tar.gz cryptography-472fd6991e05735e00fdca7fbe2573a44fdabd17.tar.bz2 cryptography-472fd6991e05735e00fdca7fbe2573a44fdabd17.zip |
Changes builder extension API.
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptography/x509.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index b1aa0679..f518b68e 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -1460,12 +1460,14 @@ class CertificateSigningRequestBuilder(object): raise TypeError('Expecting x509.Name object.') return CertificateSigningRequestBuilder(name, self._extensions) - def add_extension(self, extension): + def add_extension(self, extension, critical=False): """ Adds an X.509 extension to the certificate request. """ - if not isinstance(extension, Extension): - raise TypeError('Expecting x509.Extension object.') + if isinstance(extension, BasicConstraints): + extension = Extension(OID_BASIC_CONSTRAINTS, critical, extension) + else: + raise ValueError('Unsupported X.509 extension.') for e in self._extensions: if e.oid == extension.oid: raise ValueError('This extension has already been set.') |