creating public key from RSA private key
RSA key generation and signature test
This commit is contained in:
@@ -454,6 +454,26 @@ bool gmp_rsa_public_key_build_id(mpz_t n, mpz_t e, identification_t **keyid,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a public key from mpz values, used in gmp_rsa_private_key
|
||||
*/
|
||||
gmp_rsa_public_key_t *gmp_rsa_public_key_create_from_n_e(mpz_t n, mpz_t e)
|
||||
{
|
||||
private_gmp_rsa_public_key_t *this = gmp_rsa_public_key_create_empty();
|
||||
|
||||
mpz_init_set(this->n, n);
|
||||
mpz_init_set(this->e, e);
|
||||
|
||||
this->k = (mpz_sizeinbase(this->n, 2) + 7) / 8;
|
||||
if (!gmp_rsa_public_key_build_id(this->n, this->e,
|
||||
&this->keyid, &this->keyid_info))
|
||||
{
|
||||
destroy(this);
|
||||
return NULL;
|
||||
}
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a public key from an ASN1 encoded blob
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user