diff options
author | Alex Stapleton <alexs@prol.etari.at> | 2014-05-03 21:50:39 +0100 |
---|---|---|
committer | Alex Stapleton <alexs@prol.etari.at> | 2014-05-03 21:50:39 +0100 |
commit | 595393dd4d84f1bbb6541082b837c6cfb1aaa71b (patch) | |
tree | bdd6ac952da562695ebaab440aeeb75dbbfd221f /tests/hazmat/primitives | |
parent | d798d7a65ec94a990bd2fd17c864f80c30b01960 (diff) | |
download | cryptography-595393dd4d84f1bbb6541082b837c6cfb1aaa71b.tar.gz cryptography-595393dd4d84f1bbb6541082b837c6cfb1aaa71b.tar.bz2 cryptography-595393dd4d84f1bbb6541082b837c6cfb1aaa71b.zip |
DSA support
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r-- | tests/hazmat/primitives/test_serialization.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py index 7e6987c4..8d3b8fd4 100644 --- a/tests/hazmat/primitives/test_serialization.py +++ b/tests/hazmat/primitives/test_serialization.py @@ -19,6 +19,7 @@ import textwrap import pytest +from cryptography.hazmat.primitives.asymmetric import dsa, rsa from cryptography.hazmat.primitives.serialization import ( load_pem_traditional_openssl_private_key ) @@ -48,8 +49,29 @@ class TestTraditionalOpenSSLSerialisation(object): ) assert key + assert isinstance(key, rsa.RSAPrivateKey) _check_rsa_private_key(key) + @pytest.mark.parametrize( + ("key_file", "password"), + [ + ("dsa.1024.pem", None), + ("dsa.2048.pem", None), + ("dsa.3072.pem", None), + ] + ) + def test_load_pem_dsa_private_key(self, key_file, password, backend): + key = load_vectors_from_file( + os.path.join( + "asymmetric", "Traditional_OpenSSL_Serialization", key_file), + lambda pemfile: load_pem_traditional_openssl_private_key( + pemfile.read().encode(), password, backend + ) + ) + + assert key + assert isinstance(key, dsa.DSAPrivateKey) + def test_key1_pem_encrypted_values(self, backend): pkey = load_vectors_from_file( os.path.join( |