Juan Carlos Castro y Castro wrote:
>
> How do I generate a valid RSA structure from the n (modulus) and the e
> (10001h most often, I see) alone?
>
You can generate a valid public key from both of those, just do an:
RSA *key;
key = RSA_new();
Then fill in the key->e and key->n BIGNUM members. How you do that
depends on what form the integers are in.
For example,
BN_hex2bn(&key->n, "F12334435497...");
if its a hex string. There's a whole bunch of BIGNUM conversion routines
available for things like converting words, big endian buffers, hex
(like above) and decimal strings.
You can't generate a private key with e and n because that would be the
same as being able to obtain a private key just knowing the public key!
Though you can generate a private key with a given value of e and have
it fill in the value of n (and all the other components).
Steve.
--
Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]