summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJun Omae <jun66j5@gmail.com>2022-01-06 16:49:44 +0900
committerJeff Forcier <jeff@bitprophet.org>2022-03-18 16:46:17 -0400
commit4ef50df54d3dad257afe2663f34dab3c06090b10 (patch)
treea407eb00fda79fe549d99c60bcc25ff41df78db6 /tests
parent37bd541b54f56e06b75691bb6f8338eed2a859a5 (diff)
Fix publickey authentication with signed RSA key
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 0cc20133..e652740c 100644
--- a/tests/test_pkey.py
+++ b/tests/test_pkey.py
@@ -696,3 +696,22 @@ class KeyTest(unittest.TestCase):
key1.load_certificate,
_support("test_rsa.key-cert.pub"),
)
+
+ 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)