1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -05:00

Give a better error message if a PuTTY private key file has a version

number we don't understand. It's nicer to report 'format too new' than
'not a PuTTY key file'.

[originally from svn r9763]
This commit is contained in:
Simon Tatham
2013-02-22 21:39:02 +00:00
parent 8f3cc4a9bf
commit 40ce043a97
2 changed files with 16 additions and 6 deletions

View File

@ -779,11 +779,13 @@ int main(int argc, char **argv)
if (!load_encrypted) {
ssh2blob = ssh2_userkey_loadpub(infilename, &ssh2alg,
&ssh2bloblen, NULL, &error);
ssh2algf = find_pubkey_alg(ssh2alg);
if (ssh2algf)
bits = ssh2algf->pubkey_bits(ssh2blob, ssh2bloblen);
else
bits = -1;
if (ssh2blob) {
ssh2algf = find_pubkey_alg(ssh2alg);
if (ssh2algf)
bits = ssh2algf->pubkey_bits(ssh2blob, ssh2bloblen);
else
bits = -1;
}
} else {
ssh2key = ssh2_load_userkey(infilename, passphrase, &error);
}