summaryrefslogtreecommitdiff
path: root/OpenSSL/test/test_crypto.py
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSSL/test/test_crypto.py')
-rw-r--r--OpenSSL/test/test_crypto.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/OpenSSL/test/test_crypto.py b/OpenSSL/test/test_crypto.py
index e0d7b27..62b9429 100644
--- a/OpenSSL/test/test_crypto.py
+++ b/OpenSSL/test/test_crypto.py
@@ -630,6 +630,20 @@ class PKeyTests(TestCase):
self.assertRaises(TypeError, PKey().check, 1)
+ def test_check_public_key(self):
+ """
+ :py:meth:`PKeyType.check` raises :py:exc:`TypeError` if only the public
+ part of the key is available.
+ """
+ # A trick to get a public-only key
+ key = PKey()
+ key.generate_key(TYPE_RSA, 512)
+ cert = X509()
+ cert.set_pubkey(key)
+ pub = cert.get_pubkey()
+ self.assertRaises(TypeError, pub.check)
+
+
class X509NameTests(TestCase):
"""