From 4ef50df54d3dad257afe2663f34dab3c06090b10 Mon Sep 17 00:00:00 2001 From: Jun Omae Date: Thu, 6 Jan 2022 16:49:44 +0900 Subject: Fix publickey authentication with signed RSA key --- tests/test_pkey.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests/test_pkey.py') 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) -- cgit v1.2.3