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

Clean up the crufty old SSH-1 RSA API.

Lots of functions had really generic names (like 'makekey'), or names
that missed out an important concept (like 'rsakey_pubblob', which
loads a public blob from a _file_ and doesn't generate it from an
in-memory representation at all). Also, the opaque 'int order' that
distinguishes the two formats of public key blob is now a mnemonic
enumeration, and while I'm at it, rsa_ssh1_public_blob takes one of
those as an extra argument.
This commit is contained in:
Simon Tatham
2018-05-24 08:22:44 +01:00
parent 1a02274272
commit 7e8ae41a3f
8 changed files with 109 additions and 89 deletions

View File

@ -769,7 +769,7 @@ int main(int argc, char **argv)
* Find out whether the input key is encrypted.
*/
if (intype == SSH_KEYTYPE_SSH1)
encrypted = rsakey_encrypted(infilename, &origcomment);
encrypted = rsa_ssh1_encrypted(infilename, &origcomment);
else if (intype == SSH_KEYTYPE_SSH2)
encrypted = ssh2_userkey_encrypted(infilename, &origcomment);
else
@ -811,8 +811,8 @@ int main(int argc, char **argv)
unsigned char *blob;
int n, l, bloblen;
ret = rsakey_pubblob(infilename, &vblob, &bloblen,
&origcomment, &error);
ret = rsa_ssh1_loadpub(infilename, &vblob, &bloblen,
&origcomment, &error);
blob = (unsigned char *)vblob;
n = 4; /* skip modulus bits */
@ -836,7 +836,8 @@ int main(int argc, char **argv)
ssh1key->q = NULL;
ssh1key->iqmp = NULL;
} else {
ret = loadrsakey(infilename, ssh1key, old_passphrase, &error);
ret = rsa_ssh1_loadkey(
infilename, ssh1key, old_passphrase, &error);
}
if (ret > 0)
error = NULL;
@ -972,7 +973,7 @@ int main(int argc, char **argv)
case PRIVATE:
if (sshver == 1) {
assert(ssh1key);
ret = saversakey(outfilename, ssh1key, new_passphrase);
ret = rsa_ssh1_savekey(outfilename, ssh1key, new_passphrase);
if (!ret) {
fprintf(stderr, "puttygen: unable to save SSH-1 private key\n");
return 1;