diff options
author | Alex Stapleton <alex@ly.st> | 2014-05-27 11:58:33 +0100 |
---|---|---|
committer | Alex Stapleton <alexs@prol.etari.at> | 2014-05-27 21:50:31 +0100 |
commit | 92838d1c1a17988ad0db2fdf7450e9b717065153 (patch) | |
tree | 33830a458616b8f3b7802c29de3a47b29d54addd /tests/hazmat/primitives | |
parent | 95888742992f54e5b03ba2963695762bb7aed53f (diff) | |
download | cryptography-92838d1c1a17988ad0db2fdf7450e9b717065153.tar.gz cryptography-92838d1c1a17988ad0db2fdf7450e9b717065153.tar.bz2 cryptography-92838d1c1a17988ad0db2fdf7450e9b717065153.zip |
Unknown algorithm test for PKCS8
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r-- | tests/hazmat/primitives/test_serialization.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py index 36dbfcd8..b1789631 100644 --- a/tests/hazmat/primitives/test_serialization.py +++ b/tests/hazmat/primitives/test_serialization.py @@ -476,3 +476,19 @@ class TestPKCS8Serialisation(object): assert key assert isinstance(key, dsa.DSAPrivateKey) + + @pytest.mark.parametrize( + ("key_file", "password"), + [ + ("bad-oid-dsa-key.pem", None), + ] + ) + def test_load_bad_oid_key(self, key_file, password, backend): + with pytest.raises(ValueError): + key = load_vectors_from_file( + os.path.join( + "asymmetric", "PKCS8", key_file), + lambda pemfile: load_pem_traditional_openssl_private_key( + pemfile.read().encode(), password, backend + ) + ) |