aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-09-08 11:40:48 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2014-09-08 11:40:48 -0700
commitf0ca2e8bf0eaaba32ea0fe1a608c2a5c6348f5fa (patch)
tree896d51f203f627fce998fdec0fb404e0788ee5ee /tests
parent86dd8345a9bd8f826b950b4574072427676f43b3 (diff)
downloadcryptography-f0ca2e8bf0eaaba32ea0fe1a608c2a5c6348f5fa.tar.gz
cryptography-f0ca2e8bf0eaaba32ea0fe1a608c2a5c6348f5fa.tar.bz2
cryptography-f0ca2e8bf0eaaba32ea0fe1a608c2a5c6348f5fa.zip
Start moving everything to the new API
Diffstat (limited to 'tests')
-rw-r--r--tests/hazmat/primitives/test_serialization.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py
index 30ac4f3d..e960878b 100644
--- a/tests/hazmat/primitives/test_serialization.py
+++ b/tests/hazmat/primitives/test_serialization.py
@@ -22,15 +22,33 @@ import pytest
from cryptography.exceptions import _Reasons
from cryptography.hazmat.primitives import interfaces
from cryptography.hazmat.primitives.serialization import (
- load_pem_pkcs8_private_key, load_pem_traditional_openssl_private_key
+ load_pem_private_key, load_pem_pkcs8_private_key,
+ load_pem_traditional_openssl_private_key
)
from .utils import _check_rsa_private_numbers, load_vectors_from_file
from ...utils import raises_unsupported_algorithm
+@pytest.mark.pem_serialization
+class TestPEMSerialization(object):
+ def test_load_pem_rsa_private_key(self, backend):
+ key = load_vectors_from_file(
+ os.path.join(
+ "asymmetric", "Traditional_OpenSSL_Serialization", "key1.pem"),
+ lambda pemfile: load_pem_private_key(
+ pemfile.read().encode(), b"123456", backend
+ )
+ )
+
+ assert key
+ assert isinstance(key, interfaces.RSAPrivateKey)
+ if isinstance(key, interfaces.RSAPrivateKeyWithNumbers):
+ _check_rsa_private_numbers(key.private_numbers())
+
+
@pytest.mark.traditional_openssl_serialization
-class TestTraditionalOpenSSLSerialisation(object):
+class TestTraditionalOpenSSLSerialization(object):
@pytest.mark.parametrize(
("key_file", "password"),
[
@@ -252,7 +270,7 @@ class TestTraditionalOpenSSLSerialisation(object):
@pytest.mark.pkcs8_serialization
-class TestPKCS8Serialisation(object):
+class TestPKCS8Serialization(object):
@pytest.mark.parametrize(
("key_file", "password"),
[