Hi,

I'm trying to create an RSA keypair with the RSA_generate_key function.
After seeding the PRNG with some random values, I call RSA_generate_key this way:
RSA *pRsa = RSA_generate_key(
     1024,     // key length
     257,      // exponent
     progress, // shows progress
     NULL      // given to the progresscallback function
     );

After this has completed, I display its output:
        printf("n size: %d (bits)\n", BN_num_bits(pRsa -> n));
        printf("e size: %d (bits)\n", BN_num_bits(pRsa -> e));
        printf("d size: %d (bits)\n", BN_num_bits(pRsa -> d));

I would then expect the output for 'n' and 'd' to be 1024 and 'e' to be 9, but
in reality 'n' is 9 bits, 'e' is 1024 bits and 'd' is 512(!) bits!

So now my questions are:
- for openssl, what is the public and what is the secret key? I would expect
  n to be the public and d the secret key but due to the fact that n contains the
  exponent after RSA_generate_key() returns I'm no longer sure
- why is it that 'd' is only 512 bits? I've set the key length to 1024 bits so my
  guess is that both the public and the secret part of the RSA keypair is 1024
  bits, right?


Thank you,

Folkert van Heusden.

-----------------------------------------------
Folkert van Heusden
Rabobank IBS, GEA ontwikkelingsteam
Locatie: UHG526, postadres: UHG439
Tel:     +31 30 2161262
Fax:     +31 30 2161922
e-mail: [EMAIL PROTECTED]
-----------------------------------------------
Yacht [ www.yachtgroup.com ]
Tel:    +31 800 9990990
e-mail: [EMAIL PROTECTED]
-----------------------------------------------
Testcentrum Gouda [ www.testcentrumgouda.nl ]
e-mail: [EMAIL PROTECTED]
-----------------------------------------------
Prive [ www.vanheusden.com ]
GSM:    +31 6 41278122
Microsoft Netmeeting: keetweej.vanheusden.com
e-mail: [EMAIL PROTECTED]
-----------------------------------------------


================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en 
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht 
onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en 
de afzender direct te informeren door het bericht te retourneren. 
================================================
The information contained in this message may be confidential 
and is intended to be exclusively for the addressee. Should you 
receive this message unintentionally, please do not use the contents 
herein and notify the sender immediately by return e-mail.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to