From f06b6be82300d9339bcfb062aedd7d7a3865aec9 Mon Sep 17 00:00:00 2001 From: Ian Cordasco Date: Sun, 21 Jun 2015 10:09:18 -0500 Subject: Address review comments around add_extension method - Fix typo in the docs (s/buidlder/builder/) - Remove default from the method declaration and docs - Replace ValueError with NotImpelementedError for unsupported X.509 extensions - Add TODO comment as requested by Alex - Fix test to pass critical=False since it no longer is a default value --- src/cryptography/x509.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/cryptography/x509.py b/src/cryptography/x509.py index f59ea78a..21e18ddd 100644 --- a/src/cryptography/x509.py +++ b/src/cryptography/x509.py @@ -1462,14 +1462,15 @@ class CertificateSigningRequestBuilder(object): raise ValueError('The subject name may only be set once.') return CertificateSigningRequestBuilder(name, self._extensions) - def add_extension(self, extension, critical=False): + def add_extension(self, extension, critical): """ Adds an X.509 extension to the certificate request. """ if isinstance(extension, BasicConstraints): extension = Extension(OID_BASIC_CONSTRAINTS, critical, extension) else: - raise ValueError('Unsupported X.509 extension.') + raise NotImplementedError('Unsupported X.509 extension.') + # TODO: This is quadratic in the number of extensions for e in self._extensions: if e.oid == extension.oid: raise ValueError('This extension has already been set.') -- cgit v1.2.3