1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Restore the ability to write out PPK v2.

This commit adds the capability in principle to ppk_save_sb, by adding
a fmt_version field in the save parameters structure. As yet it's not
connected up to any user interface in PuTTYgen, but I think I'll need
to, because currently there's no way at all to convert PPK v3 back to
v2, and surely people will need to interoperate with older
installations of PuTTY, or with other PPK-consuming software.
This commit is contained in:
Simon Tatham
2021-02-21 22:29:10 +00:00
parent 66983e2410
commit e9aa28fe02
5 changed files with 45 additions and 19 deletions

View File

@ -2163,17 +2163,21 @@ Private-MAC: 6f5e588e475e55434106ec2c3569695b03f423228b44993a9e97d52ffe7be5a8
salt = unhex('37c3911bfefc8c1d11ec579627d2b3d9')
with queued_specific_random_data(salt):
self.assertEqual(ppk_save_sb(k1, comment, None, 'id', 8192, 13, 1),
self.assertEqual(ppk_save_sb(k1, comment, None,
3, 'id', 8192, 13, 1),
input_clear_key)
with queued_specific_random_data(salt):
self.assertEqual(ppk_save_sb(k2, comment, None, 'id', 8192, 13, 1),
self.assertEqual(ppk_save_sb(k2, comment, None,
3, 'id', 8192, 13, 1),
input_clear_key)
with queued_specific_random_data(salt):
self.assertEqual(ppk_save_sb(k1, comment, pp, 'id', 8192, 13, 1),
self.assertEqual(ppk_save_sb(k1, comment, pp,
3, 'id', 8192, 13, 1),
input_encrypted_key)
with queued_specific_random_data(salt):
self.assertEqual(ppk_save_sb(k2, comment, pp, 'id', 8192, 13, 1),
self.assertEqual(ppk_save_sb(k2, comment, pp,
3, 'id', 8192, 13, 1),
input_encrypted_key)
# And check we can still handle v2 key files.
@ -2219,6 +2223,13 @@ Private-MAC: 5b1f6f4cc43eb0060d2c3e181bc0129343adba2b
self.assertEqual(ssh_key_private_blob(k1), privblob)
self.assertEqual(ssh_key_private_blob(k2), privblob)
self.assertEqual(ppk_save_sb(k2, comment, None,
2, 'id', 8192, 13, 1),
v2_clear_key)
self.assertEqual(ppk_save_sb(k1, comment, pp,
2, 'id', 8192, 13, 1),
v2_encrypted_key)
def testRSA1LoadSave(self):
# Stability test of SSH-1 RSA key-file load/save functions.
input_clear_key = unhex(