diff options
author | Alex Stapleton <alex@ly.st> | 2014-05-27 12:14:09 +0100 |
---|---|---|
committer | Alex Stapleton <alexs@prol.etari.at> | 2014-05-27 21:50:31 +0100 |
commit | 70ada5893662cae303f716c2e3cac03989c5e2d9 (patch) | |
tree | 16546fdedeeb61b0933ea2ddff3bd25b7f738c99 /tests/hazmat | |
parent | eefc3920d548c7fcee01b898cb9b0705b02e9537 (diff) | |
download | cryptography-70ada5893662cae303f716c2e3cac03989c5e2d9.tar.gz cryptography-70ada5893662cae303f716c2e3cac03989c5e2d9.tar.bz2 cryptography-70ada5893662cae303f716c2e3cac03989c5e2d9.zip |
Add unknown cipher test for PKCS8
Diffstat (limited to 'tests/hazmat')
-rw-r--r-- | tests/hazmat/primitives/test_serialization.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py index b1789631..39d95199 100644 --- a/tests/hazmat/primitives/test_serialization.py +++ b/tests/hazmat/primitives/test_serialization.py @@ -484,8 +484,24 @@ class TestPKCS8Serialisation(object): ] ) def test_load_bad_oid_key(self, key_file, password, backend): - with pytest.raises(ValueError): - key = load_vectors_from_file( + with raises_unsupported_algorithm(None): + load_vectors_from_file( + os.path.join( + "asymmetric", "PKCS8", key_file), + lambda pemfile: load_pem_traditional_openssl_private_key( + pemfile.read().encode(), password, backend + ) + ) + + @pytest.mark.parametrize( + ("key_file", "password"), + [ + ("bad-encryption-oid.pem", b"password"), + ] + ) + def test_load_bad_encryption_oid_key(self, key_file, password, backend): + with raises_unsupported_algorithm(None): + load_vectors_from_file( os.path.join( "asymmetric", "PKCS8", key_file), lambda pemfile: load_pem_traditional_openssl_private_key( |