diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-10-01 16:03:47 -0500 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-10-01 16:03:47 -0500 |
commit | a7165c4250ce523f240638549141bd1073fc9c21 (patch) | |
tree | 4df82830a0430c1a5eb3a419d6a939e6f3f2517b | |
parent | 72d5b285220c6c3670e5163a5a9c5359352ad9b8 (diff) | |
parent | 3b22845179930f9f183a4fd3e638ebecc946f64f (diff) | |
download | cryptography-a7165c4250ce523f240638549141bd1073fc9c21.tar.gz cryptography-a7165c4250ce523f240638549141bd1073fc9c21.tar.bz2 cryptography-a7165c4250ce523f240638549141bd1073fc9c21.zip |
Merge pull request #1381 from alex/stop-generating-keys
Replace key generation with fixture usage in some tests
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 94b5818e..3bea413a 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -29,12 +29,13 @@ from cryptography.hazmat.backends.openssl.backend import ( ) from cryptography.hazmat.backends.openssl.ec import _sn_to_elliptic_curve from cryptography.hazmat.primitives import hashes, interfaces -from cryptography.hazmat.primitives.asymmetric import dsa, ec, padding, rsa +from cryptography.hazmat.primitives.asymmetric import dsa, ec, padding from cryptography.hazmat.primitives.ciphers import Cipher from cryptography.hazmat.primitives.ciphers.algorithms import AES from cryptography.hazmat.primitives.ciphers.modes import CBC, CTR from cryptography.hazmat.primitives.interfaces import BlockCipherAlgorithm +from ..primitives.fixtures_rsa import RSA_KEY_512 from ..primitives.test_ec import _skip_curve_unsupported from ...utils import load_vectors_from_file, raises_unsupported_algorithm @@ -327,11 +328,7 @@ class TestOpenSSLRSA(object): reason="Requires an older OpenSSL. Must be < 1.0.1" ) def test_non_sha1_pss_mgf1_hash_algorithm_on_old_openssl(self): - private_key = rsa.generate_private_key( - public_exponent=65537, - key_size=512, - backend=backend - ) + private_key = RSA_KEY_512.private_key(backend) with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH): private_key.signer( padding.PSS( @@ -394,11 +391,7 @@ class TestOpenSSLRSA(object): ) is False def test_unsupported_mgf1_hash_algorithm_decrypt(self): - private_key = rsa.generate_private_key( - public_exponent=65537, - key_size=512, - backend=backend - ) + private_key = RSA_KEY_512.private_key(backend) with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH): private_key.decrypt( b"0" * 64, @@ -410,11 +403,7 @@ class TestOpenSSLRSA(object): ) def test_unsupported_oaep_hash_algorithm_decrypt(self): - private_key = rsa.generate_private_key( - public_exponent=65537, - key_size=512, - backend=backend - ) + private_key = RSA_KEY_512.private_key(backend) with raises_unsupported_algorithm(_Reasons.UNSUPPORTED_HASH): private_key.decrypt( b"0" * 64, @@ -426,11 +415,7 @@ class TestOpenSSLRSA(object): ) def test_unsupported_oaep_label_decrypt(self): - private_key = rsa.generate_private_key( - public_exponent=65537, - key_size=512, - backend=backend - ) + private_key = RSA_KEY_512.private_key(backend) with pytest.raises(ValueError): private_key.decrypt( b"0" * 64, |