aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_serialization.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-12-23 11:20:22 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2014-12-23 11:20:22 -0800
commitd2fbbc2c751c08d4ddb9af006dfcdf7ddb8b1665 (patch)
tree978aeb0ddbc79941951ec94ad2ac46dde7b71405 /tests/hazmat/primitives/test_serialization.py
parenta4cc7456c3b27cd11bfbb133f88395fbad487ded (diff)
downloadcryptography-d2fbbc2c751c08d4ddb9af006dfcdf7ddb8b1665.tar.gz
cryptography-d2fbbc2c751c08d4ddb9af006dfcdf7ddb8b1665.tar.bz2
cryptography-d2fbbc2c751c08d4ddb9af006dfcdf7ddb8b1665.zip
Combined duplicated serialization tests
Diffstat (limited to 'tests/hazmat/primitives/test_serialization.py')
-rw-r--r--tests/hazmat/primitives/test_serialization.py28
1 files changed, 5 insertions, 23 deletions
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py
index 80a802d9..0eca8a67 100644
--- a/tests/hazmat/primitives/test_serialization.py
+++ b/tests/hazmat/primitives/test_serialization.py
@@ -52,6 +52,11 @@ class TestPEMSerialization(object):
(["PKCS8", "pkcs12_s2k_pem-X_9930.pem"], b"123456"),
(["PKCS8", "pkcs12_s2k_pem-X_9931.pem"], b"123456"),
(["PKCS8", "pkcs12_s2k_pem-X_9932.pem"], b"123456"),
+ (["Traditional_OpenSSL_Serialization", "key1.pem"], b"123456"),
+ (["Traditional_OpenSSL_Serialization", "key2.pem"], b"a123456"),
+ (["Traditional_OpenSSL_Serialization", "testrsa.pem"], None),
+ (["Traditional_OpenSSL_Serialization", "testrsa-encrypted.pem"],
+ b"password"),
]
)
def test_load_pem_rsa_private_key(self, key_file, password, backend):
@@ -171,29 +176,6 @@ class TestPEMSerialization(object):
interface=PEMSerializationBackend
)
class TestTraditionalOpenSSLSerialization(object):
- @pytest.mark.parametrize(
- ("key_file", "password"),
- [
- ("key1.pem", b"123456"),
- ("key2.pem", b"a123456"),
- ("testrsa.pem", None),
- ("testrsa-encrypted.pem", b"password"),
- ]
- )
- def test_load_pem_rsa_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_private_key(
- pemfile.read().encode(), password, backend
- )
- )
-
- assert key
- assert isinstance(key, interfaces.RSAPrivateKey)
- if isinstance(key, interfaces.RSAPrivateKeyWithNumbers):
- _check_rsa_private_numbers(key.private_numbers())
-
def test_key1_pem_encrypted_values(self, backend):
pkey = load_vectors_from_file(
os.path.join(