From 09d08ae07a72506b81bc640a2af70397f3ab2594 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Tue, 4 Feb 2014 16:21:48 -0800 Subject: Made OpenSSL's derive_pbkdf2_hmac raise the right exception --- tests/hazmat/backends/test_openssl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 9f00364f..ea04c133 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -16,7 +16,7 @@ import pytest from cryptography import utils from cryptography.exceptions import UnsupportedAlgorithm, InternalError from cryptography.hazmat.backends.openssl.backend import backend, Backend -from cryptography.hazmat.primitives import interfaces +from cryptography.hazmat.primitives import interfaces, hashes from cryptography.hazmat.primitives.ciphers import Cipher from cryptography.hazmat.primitives.ciphers.algorithms import AES from cryptography.hazmat.primitives.ciphers.modes import CBC @@ -146,3 +146,9 @@ class TestOpenSSL(object): b"error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:" b"data not multiple of block length" ) + + def test_derive_pbkdf2_raises_unsupported_on_old_openssl(self): + if backend.pbkdf2_hmac_supported(hashes.SHA256()): + pytest.skip("Requires an older OpenSSL") + with pytest.raises(UnsupportedAlgorithm): + backend.derive_pbkdf2_hmac(hashes.SHA256(), 10, b"", 1000, b"") -- cgit v1.2.3