> - There's no way to generate a DH private key or public key, or to
> combine them into a shared secret. (The API function names for this,
> DH_generate_key, and DH_compute_key, are also confusing.)
Mark,
AFAIK a private DH key is just a good random, nothing special like
RSA key generation procedure. So, use RAND_bytes().
Well, any any requirements here??
Next, DH public key is an exponentiation+modulus operation with
private key as a power so use BN_mod_exp*().
To calc shared secret you need another one exp+mod with your private key
as a power and your party's public one; BN_mod_exp*() again.
Now you can check API:
DH_generate_key() will put some noise into dh->priv_key and
exponent calculated to dh->pub_key.
DH_compute_key() will put shared secret into *key with BN_bn2bin().
Both use Montgomery exponentiation+mod to not let you sleep while
calculating that numbers :)
hope this helps,
Vadim
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]