William Estrada wrote:
i2d_RSAPublicKey( RSA, NULL ) is to be used to get the size of an RSA structure.

Yes it can and it does. It returns the value for the *public* key - the rest of your code is looking at the *private* key.

Change the line:
  Len = i2d_RSAPublicKey( My_RSA, NULL );
To this:
  Len = i2d_RSAPrivateKey( My_RSA, NULL );

And then you get the expected output (although printing out the pointer to the structure as an integer isn't exactly all that useful).

Size: 1024, Len: 608, RSA: 0
Size: 1024, Len: 608, RSA: 135062744

Public and private keys contain different values.
Have a look at things using 'openssl rsa'

Write the output of i2d for a public key out to a file and then:
  openssl rsa -text -noout -inform der -in public.der
and write the output of i2d for a private key out to a file and then:
  openssl rsa -text -noout -inform der -in private.der

Tim.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to