Metalpalo wrote:
Hello

Ihave got one question:

Does exist some way how to compute all attributes of private key from
modulus and private exponent?
I think as public exponent, prime1, prime2, exp1, exp2...

Thanks
If you want to generate a rsa key with openssl code (not in line command) :

   RSA *rsa_ori = RSA_new();     // create a new rsa
   BIGNUM *e = BN_new();        // create a new BN
   EVP_PKEY* key = EVP_PKEY_new();    // create a blank one

if (! BN_hex2bn(&e , /* the wanted exponent in char* , wrote in hexa i.e "010001"*/)) // set the BN value with the future exponent
       return -1; // Error : can't set the exponent
if(! RSA_generate_key_ex(rsa_ori,/* int for the key length i.e 1024 */,e,NULL)) // if the generation runs badly -> throw error
       return -1; // Error : key can't be generated
   // if can't put private part of rsa in evp -> throw error
   if  (EVP_PKEY_set1_RSA(key, RSAPrivateKey_dup(rsa_ori)) <1)
        return -1; // Error : key can't be set.
Here both RSA struct and EVP_PKEY struct contains all numbers needed to generate a rsa key.

I hope my answer help you ;)
Have a nice day,
pierre
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to