diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-03-15 21:18:16 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-03-16 17:03:40 -0400 |
commit | 24b063da632f89a5ca9693921c59a9a598200d48 (patch) | |
tree | 09d3f0ccd587c690ce563da45f12bc7a3cac9c13 /tests/hazmat/backends/test_openssl.py | |
parent | 862da0a09faf0b716a3f5a38dcac4b25205d8a2d (diff) | |
download | cryptography-24b063da632f89a5ca9693921c59a9a598200d48.tar.gz cryptography-24b063da632f89a5ca9693921c59a9a598200d48.tar.bz2 cryptography-24b063da632f89a5ca9693921c59a9a598200d48.zip |
cover a missing line for older openssl
Diffstat (limited to 'tests/hazmat/backends/test_openssl.py')
-rw-r--r-- | tests/hazmat/backends/test_openssl.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 599d1531..c5d0a013 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -21,6 +21,7 @@ from cryptography.exceptions import ( ) from cryptography.hazmat.backends.openssl.backend import backend, Backend from cryptography.hazmat.primitives import interfaces, hashes +from cryptography.hazmat.primitives.asymmetric import rsa, padding from cryptography.hazmat.primitives.ciphers import Cipher from cryptography.hazmat.primitives.ciphers.algorithms import AES from cryptography.hazmat.primitives.ciphers.modes import CBC @@ -137,6 +138,30 @@ class TestOpenSSL(object): with pytest.raises(UnsupportedHash): backend.derive_pbkdf2_hmac(hashes.SHA256(), 10, b"", 1000, b"") + @pytest.mark.skipif( + backend._lib.OPENSSL_VERSION_NUMBER >= 0x1000100f, + 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.RSAPrivateKey.generate( + public_exponent=65537, + key_size=512, + backend=backend + ) + public_key = private_key.public_key() + with pytest.raises(UnsupportedHash): + public_key.verifier( + b"sig", + padding.PSS( + mgf=padding.MGF1( + algorithm=hashes.SHA256(), + salt_length=padding.MGF1.MAX_LENGTH + ) + ), + hashes.SHA1(), + backend + ) + # This test is not in the next class because to check if it's really # default we don't want to run the setup_method before it def test_osrandom_engine_is_default(self): |