1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Factor out rsa_ssh1_private_blob_agent and expose in testcrypt.

This will come in useful in an upcoming testcrypt-using Python script.
This commit is contained in:
Simon Tatham 2020-01-09 19:16:29 +00:00
parent cbfd7dadac
commit 13e988b6ee
4 changed files with 12 additions and 7 deletions

View File

@ -1247,13 +1247,7 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
request = strbuf_new_for_agent_query();
put_byte(request, SSH1_AGENTC_ADD_RSA_IDENTITY);
put_uint32(request, mp_get_nbits(rkey->modulus));
put_mp_ssh1(request, rkey->modulus);
put_mp_ssh1(request, rkey->exponent);
put_mp_ssh1(request, rkey->private_exponent);
put_mp_ssh1(request, rkey->iqmp);
put_mp_ssh1(request, rkey->q);
put_mp_ssh1(request, rkey->p);
rsa_ssh1_private_blob_agent(BinarySink_UPCAST(request), rkey);
put_stringz(request, rkey->comment);
agent_query_synchronous(request, &vresponse, &resplen);
strbuf_free(request);

1
ssh.h
View File

@ -551,6 +551,7 @@ char *rsa_ssh1_fingerprint(RSAKey *key);
bool rsa_verify(RSAKey *key);
void rsa_ssh1_public_blob(BinarySink *bs, RSAKey *key, RsaSsh1Order order);
int rsa_ssh1_public_blob_len(ptrlen data);
void rsa_ssh1_private_blob_agent(BinarySink *bs, RSAKey *key);
void freersapriv(RSAKey *key);
void freersakey(RSAKey *key);

View File

@ -374,6 +374,15 @@ void rsa_ssh1_public_blob(BinarySink *bs, RSAKey *key,
}
}
void rsa_ssh1_private_blob_agent(BinarySink *bs, RSAKey *key)
{
rsa_ssh1_public_blob(bs, key, RSA_SSH1_MODULUS_FIRST);
put_mp_ssh1(bs, key->private_exponent);
put_mp_ssh1(bs, key->iqmp);
put_mp_ssh1(bs, key->q);
put_mp_ssh1(bs, key->p);
}
/* Given an SSH-1 public key blob, determine its length. */
int rsa_ssh1_public_blob_len(ptrlen data)
{

View File

@ -214,6 +214,7 @@ FUNC1(val_string_asciz, rsastr_fmt, val_rsa)
FUNC1(val_string_asciz, rsa_ssh1_fingerprint, val_rsa)
FUNC3(void, rsa_ssh1_public_blob, out_val_string_binarysink, val_rsa, rsaorder)
FUNC1(int, rsa_ssh1_public_blob_len, val_string_ptrlen)
FUNC2(void, rsa_ssh1_private_blob_agent, out_val_string_binarysink, val_rsa)
/*
* The PRNG type. Similarly to hashes and MACs, I've invented an extra