RSA_generate_key function

2011-01-31 Thread Ashwin Chandra
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).

 

 



Re: RSA_generate_key function

2011-01-31 Thread David Schwartz

On 1/31/2011 5:37 PM, Ashwin Chandra 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).



Replace RSA_generate_key with your own function that returns the desired 
key. Using the same seed each time won't work because intervening 
operations can leave the PRNG in a different state. You could use your 
own PRNG to replace OpenSSL's and then put it into a particular state 
prior to calling RSA_generate_key.


DS


__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org


RE: RSA_generate_key function

2011-01-31 Thread Ashwin Chandra
Hi David,

1. I am not sure what you mean by replacing RSA_generate_key with my own
function, because I would like it to go through the process of creating
prime numbers, and modulus, etc. Basically I want the RSA_generate_key
to generate the same public key at startup each time my process runs. 

2. You say I could do this with writing my own PRNG? Do you have an
example of this?

3. I went into the RSA_generate_key code and I saw during the prime
number calculation that the function bnrand() actually uses the system
time as a seed. If this was the case, how could I ever get
RSA_generate_key to return the same public key?

-Original Message-
From: David Schwartz [mailto:dav...@webmaster.com] 
Sent: Monday, January 31, 2011 7:37 PM
To: openssl-users@openssl.org
Cc: Ashwin Chandra
Subject: Re: RSA_generate_key function

On 1/31/2011 5:37 PM, Ashwin Chandra 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).


Replace RSA_generate_key with your own function that returns the desired
key. Using the same seed each time won't work because intervening
operations can leave the PRNG in a different state. You could use your
own PRNG to replace OpenSSL's and then put it into a particular state
prior to calling RSA_generate_key.

DS




__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager   majord...@openssl.org