Michael Sierchio wrote:
Nils Larsch wrote:

Is it true that for a given P & g, I would always get the same public key



No, the private key is (should be) a random number => you get a different public key for each invocation of DH_generate_key


Not quite, no.  In fact, DH would be pretty useless if that were
the case.  See my code snippet, if you fill in the private exponent
(which is what I assume you mean by private key),  you'll always
get the same public exponent if the private exponent is the same.

I wasn't thinking about setting the private key manually :-) (sorry, I didn't looked at your code snippet). From the original post I concluded that the parameters were set manually and the private exponent was generated using OpenSSL (i.e. with DH_generate_key) => the private key was generated with BN_rand.

....
What could be the possible problem where I am getting a different secret &
pub_key every time?


Perhaps you should read a textbook about cryptography.


I think the problem may be the less-than-intuitive API.

suggestion for improvement ?


Nils

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

Reply via email to