aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2015-06-22 20:11:17 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2015-06-24 19:30:04 -0500
commit8ed8edce1764ea17800ef83f422c7a73bfdfa74b (patch)
tree06a36274bdc29393345143a63626fe75f9b953d8 /src
parent34853f362f19bab9212824a1235a2c30f84234a3 (diff)
downloadcryptography-8ed8edce1764ea17800ef83f422c7a73bfdfa74b.tar.gz
cryptography-8ed8edce1764ea17800ef83f422c7a73bfdfa74b.tar.bz2
cryptography-8ed8edce1764ea17800ef83f422c7a73bfdfa74b.zip
Add tests to the CSR Builder for EC and DSA keys
This skips certain tests on certain versions of differences in how X509_REQ_sign works on those versions. A separate pull request will address those differences.
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/backends/openssl/backend.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/cryptography/hazmat/backends/openssl/backend.py b/src/cryptography/hazmat/backends/openssl/backend.py
index a6dc0d4e..7963b5d3 100644
--- a/src/cryptography/hazmat/backends/openssl/backend.py
+++ b/src/cryptography/hazmat/backends/openssl/backend.py
@@ -801,10 +801,21 @@ class Backend(object):
return _CMACContext(self, algorithm)
def create_x509_csr(self, builder, private_key, algorithm):
- # TODO: check type of private key parameter.
if not isinstance(algorithm, hashes.HashAlgorithm):
raise TypeError('Algorithm must be a registered hash algorithm.')
+ if self._lib.OPENSSL_VERSION_NUMBER <= 0x10001000:
+ if isinstance(private_key, _DSAPrivateKey):
+ raise NotImplementedError(
+ "Certificate signing requests aren't implemented for DSA"
+ " keys on OpenSSL versions less than 1.0.1."
+ )
+ if isinstance(private_key, _EllipticCurvePrivateKey):
+ raise NotImplementedError(
+ "Certificate signing requests aren't implemented for EC"
+ " keys on OpenSSL versions less than 1.0.1."
+ )
+
# Resolve the signature algorithm.
evp_md = self._lib.EVP_get_digestbyname(
algorithm.name.encode('ascii')