Skip to content
instance method

OpenSSL::SSL::SSLContext#tmp_dh=

ctx.tmp_dh = pkey

Sets DH parameters used for ephemeral DH key exchange. This is relevant for servers only.

pkey is an instance of OpenSSL::PKey::DH. Note that key components contained in the key object, if any, are ignored. The server will always generate a new key pair for each handshake.

Added in version 3.0. See also the man page SSL_CTX_set0_tmp_dh_pkey(3).

Example:

Example
ctx = OpenSSL::SSL::SSLContext.new
ctx.tmp_dh = OpenSSL::DH.generate(2048)
svr = OpenSSL::SSL::SSLServer.new(tcp_svr, ctx)
Thread.new { svr.accept }
See also #ssl_version= #sigalgs= also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1