aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/backends/interfaces.py2
-rw-r--r--tests/hazmat/primitives/test_serialization.py28
2 files changed, 6 insertions, 24 deletions
diff --git a/cryptography/hazmat/backends/interfaces.py b/cryptography/hazmat/backends/interfaces.py
index dc720ad3..f3d64820 100644
--- a/cryptography/hazmat/backends/interfaces.py
+++ b/cryptography/hazmat/backends/interfaces.py
@@ -282,7 +282,7 @@ class PEMSerializationBackend(object):
"""
@abc.abstractmethod
- def load_pem_public_key(self, data):
+ def load_pem_public_key(self, data, password):
"""
Loads a public key from PEM encoded data.
"""
diff --git a/tests/hazmat/primitives/test_serialization.py b/tests/hazmat/primitives/test_serialization.py
index 7cbd3f71..4bc7e811 100644
--- a/tests/hazmat/primitives/test_serialization.py
+++ b/tests/hazmat/primitives/test_serialization.py
@@ -82,39 +82,21 @@ class TestPEMSerialization(object):
assert key
assert isinstance(key, interfaces.EllipticCurvePrivateKey)
- @pytest.mark.parametrize(
- ("key_file"),
- [
- os.path.join("asymmetric", "PKCS8", "unenc-rsa-pkcs8.pub.pem"),
+ def test_load_pem_rsa_public_key(self, backend):
+ key = load_vectors_from_file(
os.path.join(
"asymmetric", "PEM_Serialization", "rsa_public_key.pem"),
- ]
- )
- def test_load_pem_rsa_public_key(self, key_file, backend):
- key = load_vectors_from_file(
- key_file,
lambda pemfile: load_pem_public_key(
pemfile.read().encode(), backend
)
)
assert key
assert isinstance(key, interfaces.RSAPublicKey)
- if isinstance(key, interfaces.RSAPublicKeyWithNumbers):
- numbers = key.public_numbers()
- assert numbers.e == 65537
- @pytest.mark.parametrize(
- ("key_file"),
- [
- os.path.join("asymmetric", "PKCS8", "unenc-dsa-pkcs8.pub.pem"),
- os.path.join(
- "asymmetric", "PEM_Serialization",
- "dsa_public_key.pem"),
- ]
- )
- def test_load_pem_dsa_public_key(self, key_file, backend):
+ def test_load_pem_dsa_public_key(self, backend):
key = load_vectors_from_file(
- key_file,
+ os.path.join(
+ "asymmetric", "PEM_Serialization", "dsa_public_key.pem"),
lambda pemfile: load_pem_public_key(
pemfile.read().encode(), backend
)