summaryrefslogtreecommitdiff
path: root/tests/test_crypto.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_crypto.py')
-rw-r--r--tests/test_crypto.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_crypto.py b/tests/test_crypto.py
index b0e8e8b..34a9d6e 100644
--- a/tests/test_crypto.py
+++ b/tests/test_crypto.py
@@ -561,6 +561,12 @@ e3fJQJwX9+KsHRut6qNZDUbvRbtO1YIAwB4UJZjwAjEAtXCPURS5A4McZHnSwgTi
Td8GMrwKz0557OxxtKN6uVVy4ACFMqEw0zN/KJI1vxc9
-----END CERTIFICATE-----"""
+rsa_p_not_prime_pem = """
+-----BEGIN RSA PRIVATE KEY-----
+MBsCAQACAS0CAQcCAQACAQ8CAQMCAQACAQACAQA=
+-----END RSA PRIVATE KEY-----
+"""
+
@pytest.fixture
def x509_data():
@@ -966,6 +972,14 @@ class TestPKey(object):
with pytest.raises(TypeError):
pub.check()
+ def test_check_pr_897(self):
+ """
+ `PKey.check` raises `OpenSSL.crypto.Error` if provided with broken key
+ """
+ pkey = load_privatekey(FILETYPE_PEM, rsa_p_not_prime_pem)
+ with pytest.raises(Error):
+ pkey.check()
+
def x509_name(**attrs):
"""