> From: owner-openssl-us...@openssl.org On Behalf Of Odomae Bro > Sent: Saturday, 03 December, 2011 23:23
> I would like to generate my own DH private/public keys and > have the client/server exchange these values. The problem I am > having is that the openssl build I have is configured to use > certificates. Hence the client side is getting the server's > DH public value from the certificate. If I need to bypass this, > how do I go about this? I assume you are talking about SSL/TLS, if not describe further. AFAIK OpenSSL has no _build_ option to use or not use certs; that's a must-implement part of the protocol(s). OpenSSL _applications_ can and often do have runtime options to use certs/keys, or not; what applications are you concerned with? What exactly do you mean by public value? TLS has ciphersuites that use 'static' DH with publickey(s) in cert(s), but OpenSSL doesn't support them. (It does enable static ECDH suites, but it appears to me 'full' (both) static isn't implemented.) > The client side is retrieving the server's public key value > from s->session->sess_cert-> peer_dh_tmp i.e > dh_srvr= s->session->sess_cert-> peer_dh_tmp That is an 'ephemeral' aka 'temporary' key, NOT taken from the cert (but *signed by* the server's cert/key unless anonymous).OpenSSL does implement those. If you have a DSA (resp ECDSA) cert, you could use the *parameters* (P and G but ignore Q) from the key in the cert. > So I thought I would set the s->session->sess_cert-> > peer_dh_tmp with my custom values, but I cannot find >? the code on the server side where this is being set? peer_tmp in the client is remembered from the ServerKeyExchange message received from the server, which creates it in ssl3_send_server_key_exchange from [ec]dh_tmp or _tmp_cb. The *parameters* are set by SSL_[CTX_]set_[ec]dh_tmp[_callback]. The doc isn't entirely clear, but looking at the code it appears to me that if the callback returns a DH or ECDH *with* a keypair and SINGLE_[EC]DH_USE is not set, that keypair is used; if you return only parameters, or (always?) if parameters were pre-set, or if SINGLE_USE, a random keypair is generated. So if you want to use your own (pregenerated) DH or ECDH keys as ephemeral keys, setting a callback that returns them and leaving SINGLE_USE off should work. Of course the client and server keys must share the same parameters; if you are not using the parameters transmitted in the ServerKeyExchange to do this, I presume you do it by some other means. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org