config root man

Current Path : /usr/opt/openssl11/share/doc/openssl/html/man3/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //usr/opt/openssl11/share/doc/openssl/html/man3/SSL_CTX_set_tmp_dh_callback.html

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>SSL_CTX_set_tmp_dh_callback</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@hsxx.drive.ne.jp" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#notes">NOTES</a></li>
	<li><a href="#return_values">RETURN VALUES</a></li>
	<li><a href="#examples">EXAMPLES</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#copyright">COPYRIGHT</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>SSL_CTX_set_tmp_dh_callback, SSL_CTX_set_tmp_dh, SSL_set_tmp_dh_callback, SSL_set_tmp_dh - handle DH keys for ephemeral key exchange</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
 #include &lt;openssl/ssl.h&gt;</pre>
<pre>
 void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx,
                                  DH *(*tmp_dh_callback)(SSL *ssl, int is_export,
                                                         int keylength));
 long SSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh);</pre>
<pre>
 void SSL_set_tmp_dh_callback(SSL *ctx,
                              DH *(*tmp_dh_callback)(SSL *ssl, int is_export,
                                                     int keylength));
 long SSL_set_tmp_dh(SSL *ssl, DH *dh)</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p><code>SSL_CTX_set_tmp_dh_callback()</code> sets the callback function for <strong>ctx</strong> to be
used when a DH parameters are required to <strong>tmp_dh_callback</strong>.
The callback is inherited by all <strong>ssl</strong> objects created from <strong>ctx</strong>.</p>
<p><code>SSL_CTX_set_tmp_dh()</code> sets DH parameters to be used to be <strong>dh</strong>.
The key is inherited by all <strong>ssl</strong> objects created from <strong>ctx</strong>.</p>
<p><code>SSL_set_tmp_dh_callback()</code> sets the callback only for <strong>ssl</strong>.</p>
<p><code>SSL_set_tmp_dh()</code> sets the parameters only for <strong>ssl</strong>.</p>
<p>These functions apply to SSL/TLS servers only.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>When using a cipher with RSA authentication, an ephemeral DH key exchange
can take place. Ciphers with DSA keys always use ephemeral DH keys as well.
In these cases, the session data are negotiated using the
ephemeral/temporary DH key and the key supplied and certified
by the certificate chain is only used for signing.
Anonymous ciphers (without a permanent server key) also use ephemeral DH keys.</p>
<p>Using ephemeral DH key exchange yields forward secrecy, as the connection
can only be decrypted, when the DH key is known. By generating a temporary
DH key inside the server application that is lost when the application
is left, it becomes impossible for an attacker to decrypt past sessions,
even if he gets hold of the normal (certified) key, as this key was
only used for signing.</p>
<p>In order to perform a DH key exchange the server must use a DH group
(DH parameters) and generate a DH key. The server will always generate
a new DH key during the negotiation.</p>
<p>As generating DH parameters is extremely time consuming, an application
should not generate the parameters on the fly but supply the parameters.
DH parameters can be reused, as the actual key is newly generated during
the negotiation. The risk in reusing DH parameters is that an attacker
may specialize on a very often used DH group. Applications should therefore
generate their own DH parameters during the installation process using the
openssl <em>dhparam(1)</em> application. This application
guarantees that &quot;strong&quot; primes are used.</p>
<p>Files dh2048.pem, and dh4096.pem in the 'apps' directory of the current
version of the OpenSSL distribution contain the 'SKIP' DH parameters,
which use safe primes and were generated verifiably pseudo-randomly.
These files can be converted into C code using the <strong>-C</strong> option of the
<em>dhparam(1)</em> application. Generation of custom DH
parameters during installation should still be preferred to stop an
attacker from specializing on a commonly used group. File dh1024.pem
contains old parameters that must not be used by applications.</p>
<p>An application may either directly specify the DH parameters or
can supply the DH parameters via a callback function.</p>
<p>Previous versions of the callback used <strong>is_export</strong> and <strong>keylength</strong>
parameters to control parameter generation for export and non-export
cipher suites. Modern servers that do not support export cipher suites
are advised to either use <code>SSL_CTX_set_tmp_dh()</code> or alternatively, use
the callback but ignore <strong>keylength</strong> and <strong>is_export</strong> and simply
supply at least 2048-bit parameters in the callback.</p>
<p>
</p>
<hr />
<h1><a name="return_values">RETURN VALUES</a></h1>
<p><code>SSL_CTX_set_tmp_dh_callback()</code> and <code>SSL_set_tmp_dh_callback()</code> do not return
diagnostic output.</p>
<p><code>SSL_CTX_set_tmp_dh()</code> and <code>SSL_set_tmp_dh()</code> do return 1 on success and 0
on failure. Check the error queue to find out the reason of failure.</p>
<p>
</p>
<hr />
<h1><a name="examples">EXAMPLES</a></h1>
<p>Setup DH parameters with a key length of 2048 bits. (Error handling
partly left out.)</p>
<p>Command-line parameter generation:</p>
<pre>
 $ openssl dhparam -out dh_param_2048.pem 2048</pre>
<p>Code for setting up parameters during server initialization:</p>
<pre>
 SSL_CTX ctx = SSL_CTX_new();</pre>
<pre>
 DH *dh_2048 = NULL;
 FILE *paramfile = fopen(&quot;dh_param_2048.pem&quot;, &quot;r&quot;);</pre>
<pre>
 if (paramfile) {
     dh_2048 = PEM_read_DHparams(paramfile, NULL, NULL, NULL);
     fclose(paramfile);
 } else {
     /* Error. */
 }
 if (dh_2048 == NULL)
     /* Error. */
 if (SSL_CTX_set_tmp_dh(ctx, dh_2048) != 1)
     /* Error. */
 ...</pre>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>ssl(7)</em>, <em>SSL_CTX_set_cipher_list(3)</em>,
<em>SSL_CTX_set_options(3)</em>,
<em>ciphers(1)</em>, <em>dhparam(1)</em></p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2001-2019 The OpenSSL Project Authors. All Rights Reserved.</p>
<p>Licensed under the OpenSSL license (the &quot;License&quot;).  You may not use
this file except in compliance with the License.  You can obtain a copy
in the file LICENSE in the source distribution or at
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>

</body>

</html>

Man Man