summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2022-03-18 16:48:50 -0400
committerJeff Forcier <jeff@bitprophet.org>2022-03-18 16:48:50 -0400
commitb9292e02106a81f522983c71187c29388d4b8e72 (patch)
treee84f0c191ce04fa0110a3220748ab694eefcf090 /tests
parent9cdd965cd9edd645364e905be1644b492bf581a1 (diff)
parentd25e5f31490da2aee8b75d8a3aca338abc490f73 (diff)
Merge branch '2.9' into 2.10
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pkey.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_pkey.py b/tests/test_pkey.py
index cff99aac..e1a3a362 100644
--- a/tests/test_pkey.py
+++ b/tests/test_pkey.py
@@ -754,3 +754,22 @@ class KeyTest(unittest.TestCase):
finally:
if os.path.exists(new):
os.unlink(new)
+
+ def test_sign_rsa_with_certificate(self):
+ data = b"ice weasels"
+ key_path = _support(os.path.join("cert_support", "test_rsa.key"))
+ key = RSAKey.from_private_key_file(key_path)
+ msg = key.sign_ssh_data(data, "rsa-sha2-256")
+ msg.rewind()
+ assert "rsa-sha2-256" == msg.get_text()
+ sign = msg.get_binary()
+ cert_path = _support(
+ os.path.join("cert_support", "test_rsa.key-cert.pub")
+ )
+ key.load_certificate(cert_path)
+ msg = key.sign_ssh_data(data, "rsa-sha2-256-cert-v01@openssh.com")
+ msg.rewind()
+ assert "rsa-sha2-256" == msg.get_text()
+ assert sign == msg.get_binary()
+ msg.rewind()
+ assert key.verify_ssh_sig(b"ice weasels", msg)