aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2015-03-07 12:33:01 -0500
committerAlex Gaynor <alex.gaynor@gmail.com>2015-03-07 12:33:01 -0500
commit7d5483b7cd0065b1f21b068ac2278ba74c21dc67 (patch)
tree17924147ce3ec236095543cf70564ff0c970b6a7 /tests/hazmat/primitives
parente37a0a5c8d29cbede67f4731ec0edd69b63a89c0 (diff)
parent791afc0d63f6985227ea18752ccb12fa0987c420 (diff)
downloadcryptography-7d5483b7cd0065b1f21b068ac2278ba74c21dc67.tar.gz
cryptography-7d5483b7cd0065b1f21b068ac2278ba74c21dc67.tar.bz2
cryptography-7d5483b7cd0065b1f21b068ac2278ba74c21dc67.zip
Merge pull request #1715 from reaperhulk/rsa-pkcs1-public-key
RSA PKCS1 public key loading support
Diffstat (limited to 'tests/hazmat/primitives')
-rw-r--r--tests/hazmat/primitives/test_serialization.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py
index fc8f8664..07a8f02e 100644
--- a/tests/hazmat/primitives/test_serialization.py
+++ b/tests/hazmat/primitives/test_serialization.py
@@ -233,6 +233,7 @@ class TestDERSerialization(object):
"asymmetric", "DER_Serialization", "unenc-rsa-pkcs8.pub.der"),
os.path.join(
"asymmetric", "DER_Serialization", "rsa_public_key.der"),
+ os.path.join("asymmetric", "public", "PKCS1", "rsa.pub.der"),
]
)
@pytest.mark.requires_backend_interface(interface=RSABackend)
@@ -384,6 +385,7 @@ class TestPEMSerialization(object):
os.path.join("asymmetric", "PKCS8", "unenc-rsa-pkcs8.pub.pem"),
os.path.join(
"asymmetric", "PEM_Serialization", "rsa_public_key.pem"),
+ os.path.join("asymmetric", "public", "PKCS1", "rsa.pub.pem"),
]
)
def test_load_pem_rsa_public_key(self, key_file, backend):
@@ -537,7 +539,7 @@ class TestPEMSerialization(object):
)
)
- def test_wrong_format(self, backend):
+ def test_wrong_private_format(self, backend):
key_data = b"---- NOT A KEY ----\n"
with pytest.raises(ValueError):
@@ -550,6 +552,12 @@ class TestPEMSerialization(object):
key_data, b"this password will not be used", backend
)
+ def test_wrong_public_format(self, backend):
+ key_data = b"---- NOT A KEY ----\n"
+
+ with pytest.raises(ValueError):
+ load_pem_public_key(key_data, backend)
+
def test_corrupt_traditional_format(self, backend):
# privkey.pem with a bunch of data missing.
key_data = textwrap.dedent("""\