aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends
diff options
context:
space:
mode:
authorMohammed Attia <skeuomorf@gmail.com>2014-04-01 14:23:27 +0200
committerMohammed Attia <skeuomorf@gmail.com>2014-04-03 06:23:10 +0200
commit9ac7c1d9032816e161b64f8e283bffac99b85c2e (patch)
tree7c8dea0dff322a6f328888965c6e0bcf54a17267 /tests/hazmat/backends
parentdacefbad29787833676adb04cdc91ff5bfc7b8f4 (diff)
downloadcryptography-9ac7c1d9032816e161b64f8e283bffac99b85c2e.tar.gz
cryptography-9ac7c1d9032816e161b64f8e283bffac99b85c2e.tar.bz2
cryptography-9ac7c1d9032816e161b64f8e283bffac99b85c2e.zip
Add tests for DSA parameters and key generation
Diffstat (limited to 'tests/hazmat/backends')
-rw-r--r--tests/hazmat/backends/test_openssl.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py
index 016da0fc..86404fe9 100644
--- a/tests/hazmat/backends/test_openssl.py
+++ b/tests/hazmat/backends/test_openssl.py
@@ -21,7 +21,7 @@ from cryptography.exceptions import (
)
from cryptography.hazmat.backends.openssl.backend import Backend, backend
from cryptography.hazmat.primitives import hashes, interfaces
-from cryptography.hazmat.primitives.asymmetric import padding, rsa
+from cryptography.hazmat.primitives.asymmetric import dsa, padding, rsa
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import CBC
@@ -192,6 +192,17 @@ class TestOpenSSL(object):
res = backend._lib.ENGINE_free(e)
assert res == 1
+ @pytest.mark.skipif(
+ backend._lib.OPENSSL_VERSION_NUMBER >= 0x1000000f,
+ reason="Requires an older OpenSSL. Must be < 1.0.0"
+ )
+ def test_large_key_size_on_old_openssl(self):
+ with pytest.raises(ValueError):
+ dsa.DSAParameters.generate(2048, backend=backend)
+
+ with pytest.raises(ValueError):
+ dsa.DSAParameters.generate(3072, backend=backend)
+
class TestOpenSSLRandomEngine(object):
def teardown_method(self, method):