summaryrefslogtreecommitdiffhomepage
path: root/tests/test_pkey.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2022-03-18 16:49:08 -0400
committerJeff Forcier <jeff@bitprophet.org>2022-03-18 16:49:08 -0400
commit6b31705174d79608d4308a36771dc0b7fbc2acd0 (patch)
treea1e8aa1557554592ca7b177e9de9f15bf4fa77bc /tests/test_pkey.py
parentb924489765a4baccd977fe15096026175aca9894 (diff)
parentb9292e02106a81f522983c71187c29388d4b8e72 (diff)
Merge branch '2.10'
Diffstat (limited to 'tests/test_pkey.py')
-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 8aff7eac..ed62da21 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)