mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-04 13:02:47 -05:00
Expose openssh_bcrypt() to testcrypt, and test it.
I happened to notice in passing that this function doesn't have any tests (although it will have been at least somewhat tested by the cmdgen interop test system). This involved writing a wrapper that passes the passphrase and salt as ptrlens, and I decided it made more sense to make the same change to the original function too and adjust the call sites appropriately. I derived a test case by getting OpenSSH itself to make an encrypted key file, and then using the inputs and output from the password hash operation that decrypted it again.
This commit is contained in:
@ -2106,6 +2106,20 @@ culpa qui officia deserunt mollit anim id est laborum.
|
||||
"aeae2a21201eef5e347de22c922192e8f46274b0c9d33e965155a91e7686"
|
||||
"9d530e"))
|
||||
|
||||
def testOpenSSHBcrypt(self):
|
||||
# Test case created by making an OpenSSH private key file
|
||||
# using their own ssh-keygen, then decrypting it successfully
|
||||
# using PuTTYgen and printing the inputs and outputs to
|
||||
# openssh_bcrypt in the process. So this output key is known
|
||||
# to agree with OpenSSH's own answer.
|
||||
|
||||
self.assertEqualBin(
|
||||
openssh_bcrypt('test passphrase',
|
||||
unhex('d0c3b40ace4afeaf8c0f81202ae36718'),
|
||||
16, 48),
|
||||
unhex('d78ba86e7273de0e007ab0ba256646823d5c902bc44293ae'
|
||||
'78547e9a7f629be928cc78ff78a75a4feb7aa6f125079c7d'))
|
||||
|
||||
def testRSAVerify(self):
|
||||
def blobs(n, e, d, p, q, iqmp):
|
||||
pubblob = ssh_string(b"ssh-rsa") + ssh2_mpint(e) + ssh2_mpint(n)
|
||||
|
Reference in New Issue
Block a user