int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb) "I would like to call this function to generate the same public/private key everytime. " I do not sure what exactly want.I suppose that you want everytime you called theRSA_generate_key_exwith same parameters and you can get same RSA key pair.
The only randomness in rsa-key generation is the generation of 'p' and 'q' ,which calls theBN_generate_prime_ex. BN_generate_prime_ex will generate a random prime by your bits parameter. So my idea is to rewrite theBN_generate_prime_ex function, caching the prime that was generated.(rewriting this function may influence other functions that call it,so i recommend to write your own version of this funcition and modify the code inRSA_generate_key_ex). Also you may rewrite theRSA_generate_key_ex,caching the RSA key. At 2011-02-01 09:37:09,"Ashwin Chandra" <achan...@panologic.com> wrote: I would like to call this function to generate the same public/private key everytime. I thought all I had to do was create the same seed using RAND_seed each time, however I still keep getting different key pairs. Is there any way to have RSA_generate_key generate the same public/private key each time? (I know this doesn’t make sense security wise, but the work I have to do requires it).