<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openssl.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Philippe+lhardy</id>
	<title>OpenSSLWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openssl.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Philippe+lhardy"/>
	<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php/Special:Contributions/Philippe_lhardy"/>
	<updated>2026-05-28T23:03:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.13</generator>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Simple_TLS_Client&amp;diff=3207</id>
		<title>Simple TLS Client</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Simple_TLS_Client&amp;diff=3207"/>
		<updated>2022-04-24T20:15:23Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
You may find an up to date example within repository demos/sslecho together with server ( [[Simple TLS Server]] )&lt;br /&gt;
&lt;br /&gt;
See [[SSL/TLS Client]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Examples]]&lt;br /&gt;
[[Category:C level]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Simple_TLS_Client&amp;diff=3206</id>
		<title>Simple TLS Client</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Simple_TLS_Client&amp;diff=3206"/>
		<updated>2022-04-24T20:14:08Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
You may find an up to date example within repository demos/sslecho together with server.&lt;br /&gt;
&lt;br /&gt;
See [[SSL/TLS Client]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Examples]]&lt;br /&gt;
[[Category:C level]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL/TLS_Client&amp;diff=3205</id>
		<title>SSL/TLS Client</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL/TLS_Client&amp;diff=3205"/>
		<updated>2022-04-24T20:13:06Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: demos/sslecho and Simple TLS Client&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[SSL/TLS Client]] is sample code for a basic web client that fetches a page. The code shown below omits error checking for brevity, but the sample available for download performs the error checking.&lt;br /&gt;
&lt;br /&gt;
The sample code will set up &amp;lt;tt&amp;gt;BIO&amp;lt;/tt&amp;gt; to fet a page from &amp;lt;tt&amp;gt;www.random.org&amp;lt;/tt&amp;gt;. The code uses TLS (not SSL) and utilizes the Server Name Indication (SNI) extension from [http://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
If you need features beyond the example below, then you should examine &amp;lt;tt&amp;gt;s_client.c&amp;lt;/tt&amp;gt; in the &amp;lt;tt&amp;gt;apps/&amp;lt;/tt&amp;gt; directory of the OpenSSL distribution. OpenSSL's &amp;lt;tt&amp;gt;s_client&amp;lt;/tt&amp;gt; implements nearly every client side feature available from the library.&lt;br /&gt;
&lt;br /&gt;
The code below does '''not''' perform hostname verification. OpenSSL prior to 1.1.0 does not perform the check, and you must perform the check yourself. The OpenSSL [http://www.openssl.org/news/changelog.html Change Log] for OpenSSL 1.1.0 states you can use &amp;lt;tt&amp;gt;-verify_name&amp;lt;/tt&amp;gt; option, and &amp;lt;tt&amp;gt;apps.c&amp;lt;/tt&amp;gt; offers &amp;lt;tt&amp;gt;-verify_hostname&amp;lt;/tt&amp;gt;. But &amp;lt;tt&amp;gt;s_client&amp;lt;/tt&amp;gt; does not respond to either switch, so its unclear how hostname checking will be implemented or invoked for a client. '''Note (N.B.)''': hostname verification is marked as experimental, so switches, options, and implementations could change.&lt;br /&gt;
&lt;br /&gt;
Finally, if you are looking for guidance on which protocols and ciphers you should be using, then see Adam Langley's blog [http://www.imperialviolet.org/2014/12/08/poodleagain.html The POODLE bites again]. The short version: use only TLS 1.2, use only ephemeral key exchanges, and use only AEAD ciphers (like AES/GCM, Camellia/GCM, ChaCha/Poly1305).&lt;br /&gt;
&lt;br /&gt;
== Implementation ==&lt;br /&gt;
&lt;br /&gt;
You may find an up to date example within repository demos/sslecho and [[Simple TLS Client]]&lt;br /&gt;
&lt;br /&gt;
The code below demonstrates a basic client that uses BIOs and TLS to connect to &amp;lt;tt&amp;gt;www.random.org&amp;lt;/tt&amp;gt;, and fetches 32 bytes of random data through an HTTP request. The sample code is available for download below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#define HOST_NAME &amp;quot;www.random.org&amp;quot;&lt;br /&gt;
#define HOST_PORT &amp;quot;443&amp;quot;&lt;br /&gt;
#define HOST_RESOURCE &amp;quot;/cgi-bin/randbyte?nbytes=32&amp;amp;format=h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
long res = 1;&lt;br /&gt;
&lt;br /&gt;
SSL_CTX* ctx = NULL;&lt;br /&gt;
BIO *web = NULL, *out = NULL;&lt;br /&gt;
SSL *ssl = NULL;&lt;br /&gt;
&lt;br /&gt;
init_openssl_library();&lt;br /&gt;
&lt;br /&gt;
const SSL_METHOD* method = SSLv23_method();&lt;br /&gt;
if(!(NULL != method)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
ctx = SSL_CTX_new(method);&lt;br /&gt;
if(!(ctx != NULL)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
/* Cannot fail ??? */&lt;br /&gt;
SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, verify_callback);&lt;br /&gt;
&lt;br /&gt;
/* Cannot fail ??? */&lt;br /&gt;
SSL_CTX_set_verify_depth(ctx, 4);&lt;br /&gt;
&lt;br /&gt;
/* Cannot fail ??? */&lt;br /&gt;
const long flags = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION;&lt;br /&gt;
SSL_CTX_set_options(ctx, flags);&lt;br /&gt;
&lt;br /&gt;
res = SSL_CTX_load_verify_locations(ctx, &amp;quot;random-org-chain.pem&amp;quot;, NULL);&lt;br /&gt;
if(!(1 == res)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
web = BIO_new_ssl_connect(ctx);&lt;br /&gt;
if(!(web != NULL)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
res = BIO_set_conn_hostname(web, HOST_NAME &amp;quot;:&amp;quot; HOST_PORT);&lt;br /&gt;
if(!(1 == res)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
BIO_get_ssl(web, &amp;amp;ssl);&lt;br /&gt;
if(!(ssl != NULL)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
const char* const PREFERRED_CIPHERS = &amp;quot;HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4&amp;quot;;&lt;br /&gt;
res = SSL_set_cipher_list(ssl, PREFERRED_CIPHERS);&lt;br /&gt;
if(!(1 == res)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
res = SSL_set_tlsext_host_name(ssl, HOST_NAME);&lt;br /&gt;
if(!(1 == res)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
out = BIO_new_fp(stdout, BIO_NOCLOSE);&lt;br /&gt;
if(!(NULL != out)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
res = BIO_do_connect(web);&lt;br /&gt;
if(!(1 == res)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
res = BIO_do_handshake(web);&lt;br /&gt;
if(!(1 == res)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
/* Step 1: verify a server certificate was presented during the negotiation */&lt;br /&gt;
X509* cert = SSL_get_peer_certificate(ssl);&lt;br /&gt;
if(cert) { X509_free(cert); } /* Free immediately */&lt;br /&gt;
if(NULL == cert) handleFailure();&lt;br /&gt;
&lt;br /&gt;
/* Step 2: verify the result of chain verification */&lt;br /&gt;
/* Verification performed according to RFC 4158    */&lt;br /&gt;
res = SSL_get_verify_result(ssl);&lt;br /&gt;
if(!(X509_V_OK == res)) handleFailure();&lt;br /&gt;
&lt;br /&gt;
/* Step 3: hostname verification */&lt;br /&gt;
/* An exercise left to the reader */&lt;br /&gt;
&lt;br /&gt;
BIO_puts(web, &amp;quot;GET &amp;quot; HOST_RESOURCE &amp;quot; HTTP/1.1\r\n&amp;quot;&lt;br /&gt;
              &amp;quot;Host: &amp;quot; HOST_NAME &amp;quot;\r\n&amp;quot;&lt;br /&gt;
              &amp;quot;Connection: close\r\n\r\n&amp;quot;);&lt;br /&gt;
BIO_puts(out, &amp;quot;\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
int len = 0;&lt;br /&gt;
do&lt;br /&gt;
{&lt;br /&gt;
  char buff[1536] = {};&lt;br /&gt;
  len = BIO_read(web, buff, sizeof(buff));&lt;br /&gt;
            &lt;br /&gt;
  if(len &amp;gt; 0)&lt;br /&gt;
    BIO_write(out, buff, len);&lt;br /&gt;
&lt;br /&gt;
} while (len &amp;gt; 0 || BIO_should_retry(web));&lt;br /&gt;
&lt;br /&gt;
if(out)&lt;br /&gt;
  BIO_free(out);&lt;br /&gt;
&lt;br /&gt;
if(web != NULL)&lt;br /&gt;
  BIO_free_all(web);&lt;br /&gt;
&lt;br /&gt;
if(NULL != ctx)&lt;br /&gt;
  SSL_CTX_free(ctx);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Initialization ==&lt;br /&gt;
&lt;br /&gt;
The sample program initializes the OpenSSL library with &amp;lt;tt&amp;gt;init_openssl_library&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;init_openssl_library&amp;lt;/tt&amp;gt; calls three OpenSSL functions.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#if (SSLEAY_VERSION_NUMBER &amp;gt;= 0x0907000L)&lt;br /&gt;
# include &amp;lt;openssl/conf.h&amp;gt;&lt;br /&gt;
#endif&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
void init_openssl_library(void)&lt;br /&gt;
{&lt;br /&gt;
  (void)SSL_library_init();&lt;br /&gt;
&lt;br /&gt;
  SSL_load_error_strings();&lt;br /&gt;
&lt;br /&gt;
  /* ERR_load_crypto_strings(); */&lt;br /&gt;
  &lt;br /&gt;
  OPENSSL_config(NULL);&lt;br /&gt;
    &lt;br /&gt;
  /* Include &amp;lt;openssl/opensslconf.h&amp;gt; to get this define */&lt;br /&gt;
#if defined (OPENSSL_THREADS)&lt;br /&gt;
  fprintf(stdout, &amp;quot;Warning: thread locking is not implemented\n&amp;quot;);&lt;br /&gt;
#endif&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_library_init&amp;lt;/tt&amp;gt;''' performs initialization of &amp;lt;tt&amp;gt;libcrypto&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;libssl&amp;lt;/tt&amp;gt;, and loads required algorithms. The documents state &amp;lt;tt&amp;gt;SSL_library_init&amp;lt;/tt&amp;gt; always returns &amp;lt;tt&amp;gt;1&amp;lt;/tt&amp;gt;, so its a useless return value.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_load_error_strings&amp;lt;/tt&amp;gt;''' loads error strings from both &amp;lt;tt&amp;gt;libcrypto&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;libssl&amp;lt;/tt&amp;gt;. There's no need to call &amp;lt;tt&amp;gt;ERR_load_crypto_strings&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;OpenSSL_add_ssl_algorithms&amp;lt;/tt&amp;gt;''' is a &amp;lt;tt&amp;gt;#define&amp;lt;/tt&amp;gt; for &amp;lt;tt&amp;gt;SSL_library_init&amp;lt;/tt&amp;gt;, so the call is omitted.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;OPENSSL_config&amp;lt;/tt&amp;gt;''' may (or may not) be needed. Internally, &amp;lt;tt&amp;gt;OPENSSL_config&amp;lt;/tt&amp;gt; is called based on a configuration options via &amp;lt;tt&amp;gt;OPENSSL_LOAD_CONF&amp;lt;/tt&amp;gt;. If you are dynamically loading an engine specified in &amp;lt;tt&amp;gt;openssl.cnf&amp;lt;/tt&amp;gt;, then you might need it so you should call it. That is, don't depend upon the OpenSSL library to call it for you.&lt;br /&gt;
&lt;br /&gt;
If you are building a multi-threaded client, you should set the locking callbacks. See [https://www.openssl.org/docs/crypto/threads.html threads(3)] for details.&lt;br /&gt;
&lt;br /&gt;
A detailed treatment of initialization can be found at [[Library Initialization]].&lt;br /&gt;
&lt;br /&gt;
== Context Setup ==&lt;br /&gt;
&lt;br /&gt;
The sample program uses '''&amp;lt;tt&amp;gt;SSLv23_method&amp;lt;/tt&amp;gt;''' to create a context. '''&amp;lt;tt&amp;gt;SSLv23_method&amp;lt;/tt&amp;gt;''' specifies that version negotiation will be used. Do not be confused by the name (it does NOT mean that only SSLv2 or SSLv3 will be used). The name is like that for historical reasons, and the function has been renamed to '''&amp;lt;tt&amp;gt;TLS_method&amp;lt;/tt&amp;gt;''' in the forthcoming OpenSSL version 1.1.0. Using this method will negotiate the highest protocol version supported by both the server and the client. SSL/TLS versions currently supported by OpenSSL 1.0.2 are SSLv2, SSLv3, TLS1.0, TLS1.1 and TLS1.2.&lt;br /&gt;
&lt;br /&gt;
The actual SSL and TLS protocols are further tuned through options. By using &amp;lt;tt&amp;gt;SSLv23_method&amp;lt;/tt&amp;gt; (and removing the unwanted protocol versions with &amp;lt;tt&amp;gt;SSL_OP_NO_SSLv2&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;SSL_OP_NO_SSLv3&amp;lt;/tt&amp;gt;), then you will effectively use TLS v1.0 and above, including TLS v1.2. You can also use &amp;lt;tt&amp;gt;SSL_OP_NO_TLSv1&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;SSL_OP_NO_TLSv1_1&amp;lt;/tt&amp;gt; if you want to use the TLS 1.2 protocol only.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_CTX_new&amp;lt;/tt&amp;gt;''' uses the &amp;lt;tt&amp;gt;SSLv23_method&amp;lt;/tt&amp;gt; method to create a new '''SSL/TLS context object'''. If you use, for example &amp;lt;tt&amp;gt;TLSv1_method&amp;lt;/tt&amp;gt;, then you will only use TLS v1.0, and if you use &amp;lt;tt&amp;gt;TLSv1_1_method&amp;lt;/tt&amp;gt; then you will only use TLS v1.1. Typically you should always use '''&amp;lt;tt&amp;gt;SSLv23_method&amp;lt;/tt&amp;gt;''' in preference to the version specific methods.&lt;br /&gt;
&lt;br /&gt;
OpenSSL 1.1.0 improves protocol selection by providing &amp;lt;tt&amp;gt;SSL_CTX_set_max_proto_version()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;SSL_CTX_set_min_proto_version()&amp;lt;/tt&amp;gt;. You no longer need to subtract unwanted options with &amp;lt;tt&amp;gt;SSL_OP_NO_SSLv2&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;SSL_OP_NO_SSLv3&amp;lt;/tt&amp;gt;. Also see the [http://www.openssl.org/docs/man1.1.0/ssl/SSL_CTX_set_max_proto_version.html &amp;lt;tt&amp;gt;SSL_CTX_set_max_proto_version()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;SSL_CTX_set_min_proto_version()&amp;lt;/tt&amp;gt; man pages].&lt;br /&gt;
&lt;br /&gt;
== Options (1) ==&lt;br /&gt;
&lt;br /&gt;
After creating a context with &amp;lt;tt&amp;gt;SSLv23_method&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;SSL_CTX_new&amp;lt;/tt&amp;gt;, the context object is tuned with the following functions:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;SSL_CTX_set_verify&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;SSL_CTX_set_verify_depth&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;SSL_CTX_set_options&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;SSL_CTX_load_verify_locations&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_CTX_set_verify&amp;lt;/tt&amp;gt;''' sets the &amp;lt;tt&amp;gt;SSL_VERIFY_PEER&amp;lt;/tt&amp;gt; flag and the verify callback. This ensures the chain is verified according to [http://tools.ietf.org/html/rfc4158 RFC 4158] and Issuer and Subject information can be printed. If you don't want to perform custom processing (such as printing or checking), then don't set the callback. OpenSSL's default checking should be sufficient, so pass &amp;lt;tt&amp;gt;NULL&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;SSL_CTX_set_verify&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
There is also a &amp;lt;tt&amp;gt;SSL_VERIFY_FAIL_IF_NO_PEER_CERT&amp;lt;/tt&amp;gt; flag, but it is used for servers and has no effect on clients. If you accidentally use &amp;lt;tt&amp;gt;SSL_VERIFY_FAIL_IF_NO_PEER_CERT&amp;lt;/tt&amp;gt;, then you chain will always verify when call &amp;lt;tt&amp;gt;SSL_get_verify_result&amp;lt;/tt&amp;gt; because the flag is ignored for clients (essentially, 0 is passed for the flag which performs no verification).&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_CTX_set_verify_depth&amp;lt;/tt&amp;gt;''' sets the chain depth to 4. Chain depth is fairly useless in practice.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_CTX_set_options&amp;lt;/tt&amp;gt;''' set the &amp;lt;tt&amp;gt;SSL_OP_ALL&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;SSL_OP_NO_SSLv2&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;SSL_OP_NO_SSLv3&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;SSL_OP_NO_COMPRESSION&amp;lt;/tt&amp;gt; options. In essence, it takes all the bug fixes and work arounds for the various servers, removes the SSL protocols (leaving only TLS protocols), and removes compression. The remaining TLS protocols are TLS 1.0, TLS 1.1, and TLS 1.2.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_CTX_load_verify_locations&amp;lt;/tt&amp;gt;''' loads the certificate chain for the &amp;lt;tt&amp;gt;random.org&amp;lt;/tt&amp;gt; site. The site's CA is Comodo, and the chain includes ''AddTrust External CA Root'', ''COMODO Certification Authority'', and ''COMODO Extended Validation Secure Server CA''. Though the chain is provided, only the single trust anchor is needed for validation. The additional intermediate certs are provided to show how to concatenate and load them.&lt;br /&gt;
&lt;br /&gt;
The PEM format means the file is a concatenation of Base64 encoded certificates with the &amp;lt;tt&amp;gt;-----BEGIN CERTIFICATE-----&amp;lt;/tt&amp;gt; prologue (and associated epilogue). If the server sends all certificates required to verify the chain (which it should), then only the ''AddTrust External CA Root'' certificate is needed.&lt;br /&gt;
&lt;br /&gt;
The options set on the &amp;lt;tt&amp;gt;CTX*&amp;lt;/tt&amp;gt; can be overridden on a per-connection basis by modifying the &amp;lt;tt&amp;gt;SSL*&amp;lt;/tt&amp;gt; using &amp;lt;tt&amp;gt;SSL_set_verify&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;SSL_set_verify_depth&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;SSL_set_options&amp;lt;/tt&amp;gt; (and friends).&lt;br /&gt;
&lt;br /&gt;
== SSL BIO ==&lt;br /&gt;
&lt;br /&gt;
The sample program uses BIOs for input and output. One BIO is used to connect to &amp;lt;tt&amp;gt;random.org&amp;lt;/tt&amp;gt;, and a second BIO is used to print output to &amp;lt;tt&amp;gt;stdout&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;BIO_new_ssl_connect&amp;lt;/tt&amp;gt;''' creates a new BIO chain consisting of an SSL BIO (using ctx) followed by a connect BIO.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;BIO_set_conn_hostname&amp;lt;/tt&amp;gt;''' is used to set the hostname and port that will be used by the connection.&lt;br /&gt;
&lt;br /&gt;
== Options (2) ==&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;BIO_get_ssl&amp;lt;/tt&amp;gt;''' is used to fetch the '''SSL connection object''' created by &amp;lt;tt&amp;gt;BIO_new_ssl_connect&amp;lt;/tt&amp;gt;. The connection object inherits from the context object, and can override the settings on the context. The connection object is tuned with the following functions:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;SSL_set_cipher_list&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_cipher_list&amp;lt;/tt&amp;gt;''' sets the cipher list. The list prefers elliptic curves, ephemeral [Diffie-Hellman], AES and SHA. It also removes NULL authentication methods and ciphers; and removes medium-security, low-security and export-grade security ciphers, such as 40-bit RC2. If desired, you could set the options on the context with &amp;lt;tt&amp;gt;SSL_CTX_set_cipher_list&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' uses the TLS SNI extension to set the hostname. If you are connecting to a Server Name Indication-aware server (such as Apache with name-based virtual hosts or IIS 8.0), then you will receive the proper certificate during the handshake.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
[[File:cipher-suites.png|thumb|right|Wireshark and ClientHello]] According to &amp;lt;tt&amp;gt;openssl ciphers ALL&amp;lt;/tt&amp;gt;, there are just over 110 cipher suites available. Each cipher suite takes 2 bytes in the &amp;lt;tt&amp;gt;ClientHello&amp;lt;/tt&amp;gt;, so advertising every cipher suite available at the client is going to cause a big &amp;lt;tt&amp;gt;ClientHello&amp;lt;/tt&amp;gt; (or bigger then needed to get the job done). When using &amp;lt;tt&amp;gt;SSL_CTX_set_cipher_list&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;SSL_set_cipher_list&amp;lt;/tt&amp;gt; with the string &amp;lt;tt&amp;gt;&amp;quot;HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4&amp;quot;&amp;lt;/tt&amp;gt;, you'll cut the number of cipher suites down to about 45. If you know the server '''does not''' support DSA, then you can add &amp;lt;tt&amp;gt;&amp;quot;!DSS&amp;quot;&amp;lt;/tt&amp;gt; and reduce the list further by about 7. And removing RSA key transport (&amp;lt;tt&amp;gt;&amp;quot;!kRSA&amp;quot;&amp;lt;/tt&amp;gt;) removes another 9 more (this is a good practice because it uses ephemeral key exchanges which provide forward secrecy). Advertising 35 or so ciphers saves about 160 bytes in the &amp;lt;tt&amp;gt;ClientHello&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Better, pick 16 or 20 ciphers you want to support and advertise them. Order them so the GCM mode ciphers from TLS 1.2 are listed first, and the AES-SHA ciphers from TLS 1.0 are listed last. Though TLS 1.0 should be avoided, its probably needed for interop because only about [https://www.trustworthyinternet.org/ssl-pulse/ half the servers on the internet support TLS 1.2]. If you control the server, then it should be offering TLS 1.2 and clients only need to advertise AEAD ciphers like AES/GCM or Camellia/GCM.&lt;br /&gt;
&lt;br /&gt;
Keeping the &amp;lt;tt&amp;gt;ClientHello&amp;lt;/tt&amp;gt; small is important for older F5 and IronPort devices. Apparently, the devices used fixed sized buffers and choke on large &amp;lt;tt&amp;gt;ClientHello&amp;lt;/tt&amp;gt;'s. In fact, a &amp;quot;large hello&amp;quot; was the cause of the TLS padding bug on IronPort devices. See [http://www.ietf.org/mail-archive/web/tls/current/msg12145.html TLS padding breaks ironport] on the TLS mailing list for details.&lt;br /&gt;
&lt;br /&gt;
== Connection ==&lt;br /&gt;
&lt;br /&gt;
[[File:bio-fetch-3.png|thumb|right|Wireshark and TLS versions]] After setting the connection object options, the sample connects to the site and negotiates a secure channel.&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;BIO_do_connect&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;BIO_do_handshake&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;BIO_do_connect&amp;lt;/tt&amp;gt;''' performs the name lookup for the host and standard TCP/IP three way handshake.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;tt&amp;gt;BIO_do_handshake&amp;lt;/tt&amp;gt;''' performs the SSL/TLS handshake. If you set a callback with &amp;lt;tt&amp;gt;SSL_CTX_set_verify&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;SSL_set_verify&amp;lt;/tt&amp;gt;, then you callback will be invoked for each certificate in the chain used during the execution of the protocol.&lt;br /&gt;
&lt;br /&gt;
The Wireshark packet capture to the right shows the TLS handshake with the SNI extension encountered during the execution of &amp;lt;tt&amp;gt;BIO_do_handshake&amp;lt;/tt&amp;gt;. OpenSSL 1.0.1e advertises TLSv1.2 as the highest protocol level in its &amp;lt;tt&amp;gt;ClientHello&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Callback ==&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides the ability for an application to interact with the chain validation by way of a callback. Normally, most application don't need to use it since the default OpenSSL behavior is usually adequate. In the callback, you can pass the &amp;lt;tt&amp;gt;preverify&amp;lt;/tt&amp;gt; result back to the library (leaving library behavior unchanged), or you can modify the result to account for a specific issue that your software should address (override default behavior). If you don't need to interact with chain validation, then don't set the callback.&lt;br /&gt;
&lt;br /&gt;
The example program returned the &amp;lt;tt&amp;gt;preverify&amp;lt;/tt&amp;gt; result to the library and just printed information about the certificate in the chain. It did so by using &amp;lt;tt&amp;gt;SSL_CTX_set_verify&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;SSL_VERIFY_PEER&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;verify_callback&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;int verify_callback(int preverify, X509_STORE_CTX* x509_ctx)&lt;br /&gt;
{&lt;br /&gt;
    int depth = X509_STORE_CTX_get_error_depth(x509_ctx);&lt;br /&gt;
    int err = X509_STORE_CTX_get_error(x509_ctx);&lt;br /&gt;
    &lt;br /&gt;
    X509* cert = X509_STORE_CTX_get_current_cert(x509_ctx);&lt;br /&gt;
    X509_NAME* iname = cert ? X509_get_issuer_name(cert) : NULL;&lt;br /&gt;
    X509_NAME* sname = cert ? X509_get_subject_name(cert) : NULL;&lt;br /&gt;
    &lt;br /&gt;
    print_cn_name(&amp;quot;Issuer (cn)&amp;quot;, iname);&lt;br /&gt;
    print_cn_name(&amp;quot;Subject (cn)&amp;quot;, sname);&lt;br /&gt;
    &lt;br /&gt;
    if(depth == 0) {&lt;br /&gt;
        /* If depth is 0, its the server's certificate. Print the SANs too */&lt;br /&gt;
        print_san_name(&amp;quot;Subject (san)&amp;quot;, cert);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return preverify;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The OpenSSL library will pass in the value of its preliminary checking of the certificate through &amp;lt;tt&amp;gt;preverify&amp;lt;/tt&amp;gt;. '''If''' you always return &amp;lt;tt&amp;gt;1&amp;lt;/tt&amp;gt; regardless of the value of &amp;lt;tt&amp;gt;preverify&amp;lt;/tt&amp;gt; or the actual result of your processing, then &amp;lt;tt&amp;gt;SSL_get_verify_result&amp;lt;/tt&amp;gt; will always return &amp;lt;tt&amp;gt;X509_V_OK&amp;lt;/tt&amp;gt;. That's probably a bad idea for production software.&lt;br /&gt;
&lt;br /&gt;
If you don't need to perform special processing on the chain, then you should forgo the &amp;lt;tt&amp;gt;verify_callback&amp;lt;/tt&amp;gt; altogether by supplying &amp;lt;tt&amp;gt;NULL&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;SSL_CTX_set_verify&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Verification ==&lt;br /&gt;
&lt;br /&gt;
You use one of two verification procedures, depending on the version of OpenSSL you are using. The change occurs at OpenSSL 1.1.0 because 1.1.0 (and above) implements hostname verification that 1.0.2 (and below) lacked. Painting with a broad brush, minimal checking includes: (1) confirm the server has a certificate, (2) confirm the certificate chain verifies back to a trusted root, and (3) confirm the name of the host matches a hostname listed in the server's certificate.&lt;br /&gt;
&lt;br /&gt;
In the end, its probably better to ignore PKI and just use Public Key Pinning (or Certificate Pinning) when a pre-exisiting relationship exists; or use a Perspectives-like system or a Trust-On-First-Use (TOFU) system when there's no ''a priori'' relationship (similar to SSH's &amp;lt;tt&amp;gt;StrictHostkeyChecking&amp;lt;/tt&amp;gt; option). See Peter Gutmann's [https://www.cs.auckland.ac.nz/~pgut001/pubs/book.pdf Engineering Security] for details of a security diversification strategy (Chapter 4, starting on page 292).&lt;br /&gt;
&lt;br /&gt;
You usually don't perform revocation in real time because it essentially creates a denial of service on your application. That is, your app will hang while downloading a multi-megabyte CRL or contacts a missing OCSP responder. For a detailed treatment of problems with PKI and Revocation, see Peter Gutmann's [https://www.cs.auckland.ac.nz/~pgut001/pubs/book.pdf Engineering Security] (Chapters 1 and 8).&lt;br /&gt;
&lt;br /&gt;
=== OpenSSL 1.0.2 ===&lt;br /&gt;
&lt;br /&gt;
OpenSSL 1.0.2 and below requires at least three checks. These versions of OpenSSL do ''not'' perform hostname validation and the API user must perform it.&lt;br /&gt;
&lt;br /&gt;
==== Server Certificate ====&lt;br /&gt;
&lt;br /&gt;
You must confirm the server provided a certificate. This is because a server might be misconfigured, or the client and server used Anonymous Diffie-Hellman. You do so as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;X509* cert = SSL_get_peer_certificate(ssl);&lt;br /&gt;
if(cert) { X509_free(cert); }&lt;br /&gt;
if(NULL == cert) handleFailure();&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the server has a certificate, then &amp;lt;tt&amp;gt;SSL_get_peer_certificate&amp;lt;/tt&amp;gt; will return a non-NULL value. You don't really need the certificate, so its &amp;lt;tt&amp;gt;free&amp;lt;/tt&amp;gt;'d immediately.&lt;br /&gt;
&lt;br /&gt;
==== Certificate Chain ====&lt;br /&gt;
&lt;br /&gt;
You must confirm the server's certificate chains back to a trusted root, and all the certificates in the chain are valid. You do so as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;long res = SSL_get_verify_result(ssl);&lt;br /&gt;
if(!(X509_V_OK == res)) handleFailure();&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;SSL_get_verify_result&amp;lt;/tt&amp;gt; returns the result of verifying the chain. See the earlier warning on doing the wrong thing in the verification callback.&lt;br /&gt;
&lt;br /&gt;
==== Certificate Names ====&lt;br /&gt;
&lt;br /&gt;
You must confirm a match between the hostname you contacted and the hostnames listed in the certificate. OpenSSL prior to 1.1.0 does not perform hostname verification, so you will have to perform the checking yourself. The sample code does not offer code at the moment, so you will need to borrow it or implement it.&lt;br /&gt;
&lt;br /&gt;
If you want to borrow the code, take a look at [http://curl.haxx.se/libcurl/ libcurl] and the verification procedure in source file &amp;lt;tt&amp;gt;ssluse.c&amp;lt;/tt&amp;gt;. Another source is the C/C++ Secure Coding Guide and Section 10.8, [http://etutorials.org/Programming/secure+programming/Chapter+10.+Public+Key+Infrastructure/10.8+Adding+Hostname+Checking+to+Certificate+Verification/ Adding Hostname Checking to Certificate Verification]. If you implement the code for checking, the sample code shows you how to extract the Common Name (CN) and Subject Alternate Names (SAN) from the certificate in &amp;lt;tt&amp;gt;print_cn_name&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;print_san_name&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
'''Note''': matching between the hostname (used in &amp;lt;tt&amp;gt;BIO_do_connect &amp;lt;/tt&amp;gt;) and names in the certificate (from &amp;lt;tt&amp;gt;SSL_get_peer_certificate&amp;lt;/tt&amp;gt;) must also be validated. For example, a certificate cannot claim to be wildcarded for &amp;lt;tt&amp;gt;*.com&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;*.net&amp;lt;/tt&amp;gt;, or other Top Level Domains (TLDs). In addition to the TLDs, you also have to country level or ccTLDs, so it can't match &amp;lt;tt&amp;gt;*.us&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;*.cn&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;*.fed.us&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;*.公司.cn&amp;lt;/tt&amp;gt; or similar levels either. Mozilla maintains a list of ccTLDs that are off limits at the [http://publicsuffix.org/ Public Suffix List], and there are currently 6136 entries on the list.&lt;br /&gt;
&lt;br /&gt;
== Program Output ==&lt;br /&gt;
&lt;br /&gt;
After all this musing, here's the lousy output you get when running the program:&lt;br /&gt;
&lt;br /&gt;
{| align=&amp;quot;center&amp;quot;&lt;br /&gt;
| [[File:bio-fetch-1.png|350px|Figure 1: Chain Output]]&lt;br /&gt;
| &amp;amp;nbsp; &amp;amp;nbsp;&lt;br /&gt;
| [[File:bio-fetch-2.png|350px|Figure 2: Server Response]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Session Reuse ==&lt;br /&gt;
&lt;br /&gt;
According to Viktor Dukhovni at [http://mta.openssl.org/pipermail/openssl-users/2016-September/004564.html Possible to control session reuse from the client]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; For performance testing purposes, I would like to turn off session&lt;br /&gt;
&amp;gt; reuse in the (homegrown) client I use for testing. Is there a function&lt;br /&gt;
&amp;gt; in the openssl library to do it?&lt;br /&gt;
&amp;gt; &lt;br /&gt;
&amp;gt; I tried googling for &amp;quot;openssl client don't send session id&amp;quot; but I didn't&lt;br /&gt;
&amp;gt; find anything useful.&lt;br /&gt;
&lt;br /&gt;
Just do nothing.  Client sessions are not reused unless you explicitly&lt;br /&gt;
arrange for reuse of a session by calling SSL_set_session() before&lt;br /&gt;
SSL_connect().  If you're trying to avoid wasting memory on storing&lt;br /&gt;
client-side sessions that you'll never reuse then this may help:&lt;br /&gt;
&lt;br /&gt;
   SSL_CTX_set_session_cache_mode(client_ctx, SSL_SESS_CACHE_OFF);&lt;br /&gt;
&lt;br /&gt;
but note this is also the default state, so is also not needed unless&lt;br /&gt;
some other code has explicitly enabled client-side caching of sessions.&lt;br /&gt;
&lt;br /&gt;
Only the server-side cache is enabled by default.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Session Tickets ==&lt;br /&gt;
&lt;br /&gt;
Session tickets are specified in [http://www.ietf.org/rfc/rfc5077.txt RFC 5077]. You can disable session tickets with &amp;lt;tt&amp;gt;SSL_OP_NO_TICKET&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;const long flags = SSL_OP_NO_SSLv3 | ... | SSL_OP_NO_TICKET;&lt;br /&gt;
SSL_CTX_set_options(ctx, flags);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 0-RTT ==&lt;br /&gt;
&lt;br /&gt;
0-RTT is specified in XXX (TODO). 0-RTT allows an application to immediately resume a previous session at the expense of consuming unauthenticated data. You should avoid 0-RTT if possible. In fact, an organization's data security policy may not allow it for some higher data sensitivity levels.&lt;br /&gt;
&lt;br /&gt;
Care should be taken if enabling 0-RTT at the client because a number of protections must be enabled at the server. Additionally, some of the protections are required higher up in the stack, outside of the secure socket layer. Below is a list of potential problems from [http://www.ietf.org/mail-archive/web/tls/current/msg15594.html 0-RTT and Anti-Replay] and [http://www.ietf.org/mail-archive/web/tls/current/msg23561.html Closing on 0-RTT] on the IETF TLS working group mailing list.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT without stateful anti-replay allows for very high number of replays, breaking rate limiting systems, even high-performance ones, resulting in an opening for DDoS attacks.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT without stateful anti-replay allows for very high number of replays, allowing exploiting timing side channels for information leakage. Very few if any applications are engineered to mitigate or eliminate such side channels.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT without global anti-replay allows leaking information from the 0-RTT data via cache timing attacks. HTTP GET URLs sent to CDNs are especially vulnerable.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT without global anti-replay allows non-idempotent actions contained in 0-RTT data to be repeated potentially lots of times. Abuse of HTTP GET for non-idempotent actions is fairly common.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT allows easily reordering request with re-transmission from the client. This can lead to various unexpected application behavior if possibility of such reordering is not taken into account. &amp;quot;Eventually consistent&amp;quot; datastores are especially vulnerable.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT exporters are not safe for authentication unless the server does global anti-replay on 0-RTT.&lt;br /&gt;
&lt;br /&gt;
== Downloads ==&lt;br /&gt;
&lt;br /&gt;
[[Media:openssl-bio-fetch.tar.gz|openssl-bio-fetch.tar.gz]] - The program and Makefile used for this wiki page.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Talk:Simple_TLS_Client&amp;diff=3204</id>
		<title>Talk:Simple TLS Client</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Talk:Simple_TLS_Client&amp;diff=3204"/>
		<updated>2022-04-24T20:11:05Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page should probably redirect to [[SSL/TLS Client]].&lt;br /&gt;
&lt;br /&gt;
If you want to direct people to OpenSSL's demo code, then mention it on the SSL/TLS Client page.&lt;br /&gt;
&lt;br /&gt;
[[User:Jwalton|Jwalton]] ([[User talk:Jwalton|talk]]) 18:50, 24 April 2022 (UTC)&lt;br /&gt;
&lt;br /&gt;
This page is referenced in Main Page 'Usage and Programming' and is counter part of [[Simple_TLS_Server]] for Client case with Category Example an C code.&lt;br /&gt;
I will reference it from [[SSL/TLS Client]].&lt;br /&gt;
&lt;br /&gt;
[[User:Philippe_lhardy]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Simple_TLS_Client&amp;diff=3203</id>
		<title>Simple TLS Client</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Simple_TLS_Client&amp;diff=3203"/>
		<updated>2022-04-24T20:05:58Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
You may find an up to date example within repository demos/sslecho together with server.&lt;br /&gt;
&lt;br /&gt;
[[Category:Examples]]&lt;br /&gt;
[[Category:C level]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Simple_TLS_Client&amp;diff=3201</id>
		<title>Simple TLS Client</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Simple_TLS_Client&amp;diff=3201"/>
		<updated>2022-04-24T16:26:44Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: reference to demos/sslecho&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
You may find an up to date example within repository demos/sslecho together with server.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Simple_TLS_Server&amp;diff=3200</id>
		<title>Simple TLS Server</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Simple_TLS_Server&amp;diff=3200"/>
		<updated>2022-04-24T16:24:42Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: add reference to demo/sslecho&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
You may find an up to date example within repository demos/sslecho.&lt;br /&gt;
&lt;br /&gt;
The code below is a complete implementation of a minimal TLS server. The first thing we do is create an ''SSL_CTX'' or SSL context. This is created using the ''TLS_server_method'' which creates a server that will negotiate the highest version of SSL/TLS supported by the client it is connecting to. The context is then configured by specifying the certificate and private key to use.&lt;br /&gt;
&lt;br /&gt;
Next we perform some normal socket programming and create a new server socket, there's nothing OpenSSL specific about this code. Whenever we get a new connection we call ''accept'' as normal. To handle the TLS we create a new ''SSL'' structure, this holds the information related to this particular connection. We use ''SSL_set_fd'' to tell openssl the file descriptor to use for the communication. In this example, we call ''SSL_accept'' to handle the server side of the TLS handshake, then use ''SSL_write()'' to send our message. Finally we clean up the various structures.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
#include &amp;lt;sys/socket.h&amp;gt;&lt;br /&gt;
#include &amp;lt;arpa/inet.h&amp;gt;&lt;br /&gt;
#include &amp;lt;openssl/ssl.h&amp;gt;&lt;br /&gt;
#include &amp;lt;openssl/err.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int create_socket(int port)&lt;br /&gt;
{&lt;br /&gt;
    int s;&lt;br /&gt;
    struct sockaddr_in addr;&lt;br /&gt;
&lt;br /&gt;
    addr.sin_family = AF_INET;&lt;br /&gt;
    addr.sin_port = htons(port);&lt;br /&gt;
    addr.sin_addr.s_addr = htonl(INADDR_ANY);&lt;br /&gt;
&lt;br /&gt;
    s = socket(AF_INET, SOCK_STREAM, 0);&lt;br /&gt;
    if (s &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;Unable to create socket&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (bind(s, (struct sockaddr*)&amp;amp;addr, sizeof(addr)) &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;Unable to bind&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (listen(s, 1) &amp;lt; 0) {&lt;br /&gt;
        perror(&amp;quot;Unable to listen&amp;quot;);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return s;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
SSL_CTX *create_context()&lt;br /&gt;
{&lt;br /&gt;
    const SSL_METHOD *method;&lt;br /&gt;
    SSL_CTX *ctx;&lt;br /&gt;
&lt;br /&gt;
    method = TLS_server_method();&lt;br /&gt;
&lt;br /&gt;
    ctx = SSL_CTX_new(method);&lt;br /&gt;
    if (!ctx) {&lt;br /&gt;
        perror(&amp;quot;Unable to create SSL context&amp;quot;);&lt;br /&gt;
        ERR_print_errors_fp(stderr);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    return ctx;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void configure_context(SSL_CTX *ctx)&lt;br /&gt;
{&lt;br /&gt;
    /* Set the key and cert */&lt;br /&gt;
    if (SSL_CTX_use_certificate_file(ctx, &amp;quot;cert.pem&amp;quot;, SSL_FILETYPE_PEM) &amp;lt;= 0) {&lt;br /&gt;
        ERR_print_errors_fp(stderr);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (SSL_CTX_use_PrivateKey_file(ctx, &amp;quot;key.pem&amp;quot;, SSL_FILETYPE_PEM) &amp;lt;= 0 ) {&lt;br /&gt;
        ERR_print_errors_fp(stderr);&lt;br /&gt;
        exit(EXIT_FAILURE);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(int argc, char **argv)&lt;br /&gt;
{&lt;br /&gt;
    int sock;&lt;br /&gt;
    SSL_CTX *ctx;&lt;br /&gt;
&lt;br /&gt;
    ctx = create_context();&lt;br /&gt;
&lt;br /&gt;
    configure_context(ctx);&lt;br /&gt;
&lt;br /&gt;
    sock = create_socket(4433);&lt;br /&gt;
&lt;br /&gt;
    /* Handle connections */&lt;br /&gt;
    while(1) {&lt;br /&gt;
        struct sockaddr_in addr;&lt;br /&gt;
        unsigned int len = sizeof(addr);&lt;br /&gt;
        SSL *ssl;&lt;br /&gt;
        const char reply[] = &amp;quot;test\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
        int client = accept(sock, (struct sockaddr*)&amp;amp;addr, &amp;amp;len);&lt;br /&gt;
        if (client &amp;lt; 0) {&lt;br /&gt;
            perror(&amp;quot;Unable to accept&amp;quot;);&lt;br /&gt;
            exit(EXIT_FAILURE);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        ssl = SSL_new(ctx);&lt;br /&gt;
        SSL_set_fd(ssl, client);&lt;br /&gt;
&lt;br /&gt;
        if (SSL_accept(ssl) &amp;lt;= 0) {&lt;br /&gt;
            ERR_print_errors_fp(stderr);&lt;br /&gt;
        } else {&lt;br /&gt;
            SSL_write(ssl, reply, strlen(reply));&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        SSL_shutdown(ssl);&lt;br /&gt;
        SSL_free(ssl);&lt;br /&gt;
        close(client);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    close(sock);&lt;br /&gt;
    SSL_CTX_free(ctx);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Session Reuse ==&lt;br /&gt;
&lt;br /&gt;
According to Viktor Dukhovni at [http://mta.openssl.org/pipermail/openssl-users/2016-September/004564.html Possible to control session reuse from the client]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; For performance testing purposes, I would like to turn off session&lt;br /&gt;
&amp;gt; reuse in the (homegrown) client I use for testing. Is there a function&lt;br /&gt;
&amp;gt; in the openssl library to do it?&lt;br /&gt;
&amp;gt; &lt;br /&gt;
&amp;gt; I tried googling for &amp;quot;openssl client don't send session id&amp;quot; but I didn't&lt;br /&gt;
&amp;gt; find anything useful.&lt;br /&gt;
&lt;br /&gt;
Just do nothing.  Client sessions are not reused unless you explicitly&lt;br /&gt;
arrange for reuse of a session by calling SSL_set_session() before&lt;br /&gt;
SSL_connect().  If you're trying to avoid wasting memory on storing&lt;br /&gt;
client-side sessions that you'll never reuse then this may help:&lt;br /&gt;
&lt;br /&gt;
   SSL_CTX_set_session_cache_mode(client_ctx, SSL_SESS_CACHE_OFF);&lt;br /&gt;
&lt;br /&gt;
but note this is also the default state, so is also not needed unless&lt;br /&gt;
some other code has explicitly enabled client-side caching of sessions.&lt;br /&gt;
&lt;br /&gt;
Only the server-side cache is enabled by default.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 0-RTT ==&lt;br /&gt;
&lt;br /&gt;
0-RTT is specified in XXX (TODO). 0-RTT allows an application to immediately resume a previous session at the expense of consuming unauthenticated data. You should avoid 0-RTT if possible. In fact, an organization's data security policy may not allow it for some higher data sensitivity levels.&lt;br /&gt;
&lt;br /&gt;
Care should be taken if enabling 0-RTT at the server because a number of protections must be enabled. Additionally, some of the protections are required higher up in the stack, outside of the secure socket layer. Below is a list of potential problems from [http://www.ietf.org/mail-archive/web/tls/current/msg23561.html Closing on 0-RTT] on the IETF TLS working group mailing list.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT without stateful anti-replay allows for very high number of replays, breaking rate limiting systems, even high-performance ones, resulting in an opening for DDoS attacks.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT without stateful anti-replay allows for very high number of replays, allowing exploiting timing side channels for information leakage. Very few if any applications are engineered to mitigate or eliminate such side channels.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT without global anti-replay allows leaking information from the 0-RTT data via cache timing attacks. HTTP GET URLs sent to CDNs are especially vulnerable.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT without global anti-replay allows non-idempotent actions contained in 0-RTT data to be repeated potentially lots of times. Abuse of HTTP GET for non-idempotent actions is fairly common.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT allows easily reordering request with re-transmission from the client. This can lead to various unexpected application behavior if possibility of such reordering is not taken into account. &amp;quot;Eventually consistent&amp;quot; datastores are especially vulnerable.&lt;br /&gt;
&lt;br /&gt;
* 0-RTT exporters are not safe for authentication unless the server does global anti-replay on 0-RTT.&lt;br /&gt;
&lt;br /&gt;
[[Category:Examples]]&lt;br /&gt;
[[Category:C level]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Talk:Command_Line_Utilities&amp;diff=3098</id>
		<title>Talk:Command Line Utilities</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Talk:Command_Line_Utilities&amp;diff=3098"/>
		<updated>2020-06-14T15:44:34Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pretty significant rewrite ==&lt;br /&gt;
&lt;br /&gt;
I noticed a lot of the information on the page was essentially a print out of the program help menu, so I thought it would be more beneficial to provide a basic introduction to the command-line utilities in tutorial form, with links to the official documentation. It isn't finished, as there are a lot of topics I didn't cover (certificates being a significant topic I did not cover), but because of the magnitude of the changes, I thought it best to stop here and get feedback on the changes. I'm brand-new to the project and I'm excited contribute in a meaningful way, so please if there is any wrong information, the style is off, etc., please do pass that along.&lt;br /&gt;
&lt;br /&gt;
This rewrite is essentially a reformatting of the previous version, with a lot of additional explanations from the perldocs. The bulk of the changes come from the removing of the old code samples, which were essentially just the helps menus, and the addition of code examples which again come primarily from the perldocs. There's also a table with all of the standard commands which link to their respective manpage on the main openssl site. I thought this was better because now we only have to update one set of documentation, which itself is automatically generated from the pod files.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jflopezfernandez|Jflopezfernandez]] ([[User talk:Jflopezfernandez|talk]]) 03:35, 30 July 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
: This new style page looks great!! Please continue with it.&lt;br /&gt;
: A point to note about the ec key generation stuff. It is not necessary to first create an ec params file. It is simpler just to generate the key directly using genpkey and passing the pkeyopt &amp;quot;ec_paramgen_curve&amp;quot;. See the man page for further details.&lt;br /&gt;
: --[[User:Matt|Matt]] ([[User talk:Matt|talk]]) 08:27, 30 July 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Awesome, I'll go ahead and add that in, thanks for the heads up. I'm glad you like the change; I was pretty nervous about it since it was a pretty big change and I'm still brand-new.&lt;br /&gt;
:: --[[User:Jflopezfernandez|Jflopezfernandez]] ([[User talk:Jflopezfernandez|talk]]) 15:27, 30 July 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: During this rewrite a comment about base64 usage 64 characters per line limit and -A usage was lost&lt;br /&gt;
::: i found it while rereading one old answer i did on stack overflow see https://askubuntu.com/questions/178521/how-can-i-decode-a-base64-string-from-the-command-line reference )&lt;br /&gt;
::: --[[User:Philippe lhardy|Philippe lhardy]] ([[User talk:Philippe lhardy|talk]]) 15:43, 14 June 2020 (UTC)&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Talk:Command_Line_Utilities&amp;diff=3097</id>
		<title>Talk:Command Line Utilities</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Talk:Command_Line_Utilities&amp;diff=3097"/>
		<updated>2020-06-14T15:43:38Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Pretty significant rewrite ==&lt;br /&gt;
&lt;br /&gt;
I noticed a lot of the information on the page was essentially a print out of the program help menu, so I thought it would be more beneficial to provide a basic introduction to the command-line utilities in tutorial form, with links to the official documentation. It isn't finished, as there are a lot of topics I didn't cover (certificates being a significant topic I did not cover), but because of the magnitude of the changes, I thought it best to stop here and get feedback on the changes. I'm brand-new to the project and I'm excited contribute in a meaningful way, so please if there is any wrong information, the style is off, etc., please do pass that along.&lt;br /&gt;
&lt;br /&gt;
This rewrite is essentially a reformatting of the previous version, with a lot of additional explanations from the perldocs. The bulk of the changes come from the removing of the old code samples, which were essentially just the helps menus, and the addition of code examples which again come primarily from the perldocs. There's also a table with all of the standard commands which link to their respective manpage on the main openssl site. I thought this was better because now we only have to update one set of documentation, which itself is automatically generated from the pod files.&lt;br /&gt;
&lt;br /&gt;
--[[User:Jflopezfernandez|Jflopezfernandez]] ([[User talk:Jflopezfernandez|talk]]) 03:35, 30 July 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
: This new style page looks great!! Please continue with it.&lt;br /&gt;
: A point to note about the ec key generation stuff. It is not necessary to first create an ec params file. It is simpler just to generate the key directly using genpkey and passing the pkeyopt &amp;quot;ec_paramgen_curve&amp;quot;. See the man page for further details.&lt;br /&gt;
: --[[User:Matt|Matt]] ([[User talk:Matt|talk]]) 08:27, 30 July 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Awesome, I'll go ahead and add that in, thanks for the heads up. I'm glad you like the change; I was pretty nervous about it since it was a pretty big change and I'm still brand-new.&lt;br /&gt;
:: --[[User:Jflopezfernandez|Jflopezfernandez]] ([[User talk:Jflopezfernandez|talk]]) 15:27, 30 July 2019 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: During this rewrite a comment about 64 characters per line limit and -A usage was lost&lt;br /&gt;
::: i found it while rereading one old answer i did on stack overflow see https://askubuntu.com/questions/178521/how-can-i-decode-a-base64-string-from-the-command-line reference )&lt;br /&gt;
::: --[[User:Philippe lhardy|Philippe lhardy]] ([[User talk:Philippe lhardy|talk]]) 15:43, 14 June 2020 (UTC)&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Mailing_Lists&amp;diff=2611</id>
		<title>Mailing Lists</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Mailing_Lists&amp;diff=2611"/>
		<updated>2017-08-28T19:45:49Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are four mailing lists, see [https://www.openssl.org/community/mailinglists.html)&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Base64&amp;diff=2330</id>
		<title>Base64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Base64&amp;diff=2330"/>
		<updated>2015-11-22T17:05:50Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* base64 uses PEM 80 characters per line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Encode binary information 8 bits into ASCII.&lt;br /&gt;
&lt;br /&gt;
This is PEM base encode, it exists other base64 encoding scheme like this used by crypt.&lt;br /&gt;
&lt;br /&gt;
== Algorithm ==&lt;br /&gt;
&lt;br /&gt;
3 x 8 bits binary are concatenated to form a 24bits word that is split in 4 x 6bits each being translating into an ascii value using a character ordered in following list :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ &lt;br /&gt;
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||&lt;br /&gt;
0000000000111111111122222222223333333333444444444455555555556666&lt;br /&gt;
0123456789012345678901234567890123456789012345678901234567890123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[what makes 26 * 2 + 10 + 2 = 64 values]&lt;br /&gt;
&lt;br /&gt;
Since it encodes by group of 3 bytes, when last group of 3 bytes miss one byte then = is used, when it miss 2 bytes then == is used for padding.&lt;br /&gt;
&lt;br /&gt;
== Openssl command ==&lt;br /&gt;
&lt;br /&gt;
base64 or -enc base64 can be used to decode lines see [[Command_Line_Utilities]]&lt;br /&gt;
&lt;br /&gt;
== EVP API ==&lt;br /&gt;
&lt;br /&gt;
crypto/evp/encode.c&lt;br /&gt;
crypto/evp/bio_b64.C&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WARNINGS ===&lt;br /&gt;
&lt;br /&gt;
=== other unsupported base64 scheme ===&lt;br /&gt;
&lt;br /&gt;
Warning crypt() password encryption function uses another base64 scheme which is not the openssl base64 one. :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&lt;br /&gt;
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||&lt;br /&gt;
0000000000111111111122222222223333333333444444444455555555556666&lt;br /&gt;
0123456789012345678901234567890123456789012345678901234567890123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== base64 uses PEM 80 characters per line ===&lt;br /&gt;
&lt;br /&gt;
Base64 itself does not impose a line split, but openssl uses it in PEM context hence enforce that base64 content is splitted by lines with a maximum of 80 characters.&lt;br /&gt;
&lt;br /&gt;
With C code it is possible to ask to disregard lines breaks : BIO_set_flags(d,BIO_FLAGS_BASE64_NO_NL);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Encoding]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Base64&amp;diff=2329</id>
		<title>Base64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Base64&amp;diff=2329"/>
		<updated>2015-11-22T17:04:06Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Encode binary information 8 bits into ASCII.&lt;br /&gt;
&lt;br /&gt;
This is PEM base encode, it exists other base64 encoding scheme like this used by crypt.&lt;br /&gt;
&lt;br /&gt;
== Algorithm ==&lt;br /&gt;
&lt;br /&gt;
3 x 8 bits binary are concatenated to form a 24bits word that is split in 4 x 6bits each being translating into an ascii value using a character ordered in following list :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ &lt;br /&gt;
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||&lt;br /&gt;
0000000000111111111122222222223333333333444444444455555555556666&lt;br /&gt;
0123456789012345678901234567890123456789012345678901234567890123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[what makes 26 * 2 + 10 + 2 = 64 values]&lt;br /&gt;
&lt;br /&gt;
Since it encodes by group of 3 bytes, when last group of 3 bytes miss one byte then = is used, when it miss 2 bytes then == is used for padding.&lt;br /&gt;
&lt;br /&gt;
== Openssl command ==&lt;br /&gt;
&lt;br /&gt;
base64 or -enc base64 can be used to decode lines see [[Command_Line_Utilities]]&lt;br /&gt;
&lt;br /&gt;
== EVP API ==&lt;br /&gt;
&lt;br /&gt;
crypto/evp/encode.c&lt;br /&gt;
crypto/evp/bio_b64.C&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WARNINGS ===&lt;br /&gt;
&lt;br /&gt;
=== other unsupported base64 scheme ===&lt;br /&gt;
&lt;br /&gt;
Warning crypt() password encryption function uses another base64 scheme which is not the openssl base64 one. :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&lt;br /&gt;
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||&lt;br /&gt;
0000000000111111111122222222223333333333444444444455555555556666&lt;br /&gt;
0123456789012345678901234567890123456789012345678901234567890123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== base64 uses PEM 80 characters per line ===&lt;br /&gt;
&lt;br /&gt;
Base64 itself does not impose a line split, but openssl uses it in PEM context hence enforce that base64 content is splitted by lines with a maximum of 80 characters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Encoding]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=DER&amp;diff=2328</id>
		<title>DER</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=DER&amp;diff=2328"/>
		<updated>2015-11-22T14:26:15Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* sample */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DER is a binary format for data structures described by ASN.1.&lt;br /&gt;
&lt;br /&gt;
by example x509 is described in ASN1 and encoded in DER. It exists other encoding formats for ASN.1 but DER is the one choose for security since ther is only one possible encoding given a ASN.1. encoding ( what is not the case for BER used in ldap by example ).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== command ==&lt;br /&gt;
&lt;br /&gt;
openssl ''asn1parse'' is the command to display internal structure of a DER document.&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell level]]&lt;br /&gt;
&lt;br /&gt;
== sample ==&lt;br /&gt;
&lt;br /&gt;
When using i2d_X509_fp(FILE * outcert, X509 * x509_cert) file result is raw DER encoded value of X509 Certificate.&lt;br /&gt;
&lt;br /&gt;
C code to dump a X509 into DER format :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void dump_x509_cert(X509* x509_cert)&lt;br /&gt;
{&lt;br /&gt;
  const char * dumpcertfile = &amp;quot;dumpcertfile&amp;quot;;&lt;br /&gt;
  if (dumpcertfile != NULL)&lt;br /&gt;
    {&lt;br /&gt;
      FILE * outcert = fopen(dumpcertfile,&amp;quot;w&amp;quot;);&lt;br /&gt;
      if ( outcert )&lt;br /&gt;
	{&lt;br /&gt;
	  i2d_X509_fp(outcert, x509_cert);&lt;br /&gt;
	  fclose(outcert);&lt;br /&gt;
	}&lt;br /&gt;
      else&lt;br /&gt;
	{&lt;br /&gt;
	  fprintf(stderr,&amp;quot;[ERROR] Can't create %s file\n&amp;quot;, dumpcerfile);&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to view content :&lt;br /&gt;
&lt;br /&gt;
openssl asn1parse -in dumpcertfile -inform DER&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    0:d=0  hl=4 l= 981 cons: SEQUENCE          &lt;br /&gt;
    4:d=1  hl=4 l= 701 cons: SEQUENCE          &lt;br /&gt;
    8:d=2  hl=2 l=   3 cons: cont [ 0 ]        &lt;br /&gt;
   10:d=3  hl=2 l=   1 prim: INTEGER           :02&lt;br /&gt;
   13:d=2  hl=2 l=   4 prim: INTEGER           :5631333F&lt;br /&gt;
   19:d=2  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
   21:d=3  hl=2 l=   9 prim: OBJECT            :sha1WithRSAEncryption&lt;br /&gt;
   32:d=3  hl=2 l=   0 prim: NULL              &lt;br /&gt;
   34:d=2  hl=2 l= 127 cons: SEQUENCE          &lt;br /&gt;
   36:d=3  hl=2 l=  11 cons: SET               &lt;br /&gt;
   38:d=4  hl=2 l=   9 cons: SEQUENCE          &lt;br /&gt;
   40:d=5  hl=2 l=   3 prim: OBJECT            :countryName&lt;br /&gt;
   45:d=5  hl=2 l=   2 prim: PRINTABLESTRING   :FR&lt;br /&gt;
   49:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
   51:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
   53:d=5  hl=2 l=   3 prim: OBJECT            :commonName&lt;br /&gt;
   58:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
   79:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
   81:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
   83:d=5  hl=2 l=   3 prim: OBJECT            :organizationName&lt;br /&gt;
   88:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  109:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  111:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  113:d=5  hl=2 l=   3 prim: OBJECT            :organizationalUnitName&lt;br /&gt;
  118:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  127:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  129:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  131:d=5  hl=2 l=   3 prim: OBJECT            :stateOrProvinceName&lt;br /&gt;
  136:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  145:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  147:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  149:d=5  hl=2 l=   3 prim: OBJECT            :localityName&lt;br /&gt;
  154:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  163:d=2  hl=2 l=  34 cons: SEQUENCE          &lt;br /&gt;
  165:d=3  hl=2 l=  15 prim: GENERALIZEDTIME   :20151028204239Z&lt;br /&gt;
  182:d=3  hl=2 l=  15 prim: GENERALIZEDTIME   :20251025204239Z&lt;br /&gt;
  199:d=2  hl=2 l= 127 cons: SEQUENCE          &lt;br /&gt;
  201:d=3  hl=2 l=  11 cons: SET               &lt;br /&gt;
  203:d=4  hl=2 l=   9 cons: SEQUENCE          &lt;br /&gt;
  205:d=5  hl=2 l=   3 prim: OBJECT            :countryName&lt;br /&gt;
  210:d=5  hl=2 l=   2 prim: PRINTABLESTRING   :FR&lt;br /&gt;
  214:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
  216:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
  218:d=5  hl=2 l=   3 prim: OBJECT            :commonName&lt;br /&gt;
  223:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  244:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
  246:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
  248:d=5  hl=2 l=   3 prim: OBJECT            :organizationName&lt;br /&gt;
  253:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  274:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  276:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  278:d=5  hl=2 l=   3 prim: OBJECT            :organizationalUnitName&lt;br /&gt;
  283:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  292:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  294:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  296:d=5  hl=2 l=   3 prim: OBJECT            :stateOrProvinceName&lt;br /&gt;
  301:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  310:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  312:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  314:d=5  hl=2 l=   3 prim: OBJECT            :localityName&lt;br /&gt;
  319:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  328:d=2  hl=4 l= 290 cons: SEQUENCE          &lt;br /&gt;
  332:d=3  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
  334:d=4  hl=2 l=   9 prim: OBJECT            :rsaEncryption&lt;br /&gt;
  345:d=4  hl=2 l=   0 prim: NULL              &lt;br /&gt;
  347:d=3  hl=4 l= 271 prim: BIT STRING        &lt;br /&gt;
  622:d=2  hl=2 l=  85 cons: cont [ 3 ]        &lt;br /&gt;
  624:d=3  hl=2 l=  83 cons: SEQUENCE          &lt;br /&gt;
  626:d=4  hl=2 l=  12 cons: SEQUENCE          &lt;br /&gt;
  628:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Basic Constraints&lt;br /&gt;
  633:d=5  hl=2 l=   1 prim: BOOLEAN           :255&lt;br /&gt;
  636:d=5  hl=2 l=   2 prim: OCTET STRING      [HEX DUMP]:3000&lt;br /&gt;
  640:d=4  hl=2 l=  19 cons: SEQUENCE          &lt;br /&gt;
  642:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Extended Key Usage&lt;br /&gt;
  647:d=5  hl=2 l=  12 prim: OCTET STRING      [HEX DUMP]:300A06082B06010505070301&lt;br /&gt;
  661:d=4  hl=2 l=  15 cons: SEQUENCE          &lt;br /&gt;
  663:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Key Usage&lt;br /&gt;
  668:d=5  hl=2 l=   1 prim: BOOLEAN           :255&lt;br /&gt;
  671:d=5  hl=2 l=   5 prim: OCTET STRING      [HEX DUMP]:0303072000&lt;br /&gt;
  678:d=4  hl=2 l=  29 cons: SEQUENCE          &lt;br /&gt;
  680:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Subject Key Identifier&lt;br /&gt;
  685:d=5  hl=2 l=  22 prim: OCTET STRING      [HEX DUMP]:0414304610060805E69AE14F84CC366012C0EB9E3D99&lt;br /&gt;
  709:d=1  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
  711:d=2  hl=2 l=   9 prim: OBJECT            :sha1WithRSAEncryption&lt;br /&gt;
  722:d=2  hl=2 l=   0 prim: NULL              &lt;br /&gt;
  724:d=1  hl=4 l= 257 prim: BIT STRING   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since it is a X509 certificate the best way to view content is &lt;br /&gt;
&lt;br /&gt;
openssl x509 -in dumpcertfile -inform DER -text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Encoding]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=DER&amp;diff=2327</id>
		<title>DER</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=DER&amp;diff=2327"/>
		<updated>2015-11-22T14:24:46Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: some sample&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;DER is a binary format for data structures described by ASN.1.&lt;br /&gt;
&lt;br /&gt;
by example x509 is described in ASN1 and encoded in DER. It exists other encoding formats for ASN.1 but DER is the one choose for security since ther is only one possible encoding given a ASN.1. encoding ( what is not the case for BER used in ldap by example ).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== command ==&lt;br /&gt;
&lt;br /&gt;
openssl ''asn1parse'' is the command to display internal structure of a DER document.&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell level]]&lt;br /&gt;
&lt;br /&gt;
== sample ==&lt;br /&gt;
&lt;br /&gt;
When using i2d_X509_fp(FILE * outcert, X509 * x509_cert) file result is raw DER encoded value of X509 Certificate.&lt;br /&gt;
&lt;br /&gt;
C code to dump a X509 into DER format :&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
void dump_x509_cert(X509* x509_cert)&lt;br /&gt;
{&lt;br /&gt;
  const char * dumpcertfile = &amp;quot;dumpcertfile&amp;quot;;&lt;br /&gt;
  if (dumpcertfile != NULL)&lt;br /&gt;
    {&lt;br /&gt;
      FILE * outcert = fopen(dumpcertfile,&amp;quot;w&amp;quot;);&lt;br /&gt;
      if ( outcert )&lt;br /&gt;
	{&lt;br /&gt;
	  i2d_X509_fp(outcert, x509_cert);&lt;br /&gt;
	  fclose(outcert);&lt;br /&gt;
	}&lt;br /&gt;
      else&lt;br /&gt;
	{&lt;br /&gt;
	  fprintf(stderr,&amp;quot;[ERROR] Can't create server.cert file\n&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to view content :&lt;br /&gt;
&lt;br /&gt;
openssl asn1parse -in dumpcertfile -inform DER&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    0:d=0  hl=4 l= 981 cons: SEQUENCE          &lt;br /&gt;
    4:d=1  hl=4 l= 701 cons: SEQUENCE          &lt;br /&gt;
    8:d=2  hl=2 l=   3 cons: cont [ 0 ]        &lt;br /&gt;
   10:d=3  hl=2 l=   1 prim: INTEGER           :02&lt;br /&gt;
   13:d=2  hl=2 l=   4 prim: INTEGER           :5631333F&lt;br /&gt;
   19:d=2  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
   21:d=3  hl=2 l=   9 prim: OBJECT            :sha1WithRSAEncryption&lt;br /&gt;
   32:d=3  hl=2 l=   0 prim: NULL              &lt;br /&gt;
   34:d=2  hl=2 l= 127 cons: SEQUENCE          &lt;br /&gt;
   36:d=3  hl=2 l=  11 cons: SET               &lt;br /&gt;
   38:d=4  hl=2 l=   9 cons: SEQUENCE          &lt;br /&gt;
   40:d=5  hl=2 l=   3 prim: OBJECT            :countryName&lt;br /&gt;
   45:d=5  hl=2 l=   2 prim: PRINTABLESTRING   :FR&lt;br /&gt;
   49:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
   51:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
   53:d=5  hl=2 l=   3 prim: OBJECT            :commonName&lt;br /&gt;
   58:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
   79:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
   81:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
   83:d=5  hl=2 l=   3 prim: OBJECT            :organizationName&lt;br /&gt;
   88:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  109:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  111:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  113:d=5  hl=2 l=   3 prim: OBJECT            :organizationalUnitName&lt;br /&gt;
  118:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  127:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  129:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  131:d=5  hl=2 l=   3 prim: OBJECT            :stateOrProvinceName&lt;br /&gt;
  136:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  145:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  147:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  149:d=5  hl=2 l=   3 prim: OBJECT            :localityName&lt;br /&gt;
  154:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  163:d=2  hl=2 l=  34 cons: SEQUENCE          &lt;br /&gt;
  165:d=3  hl=2 l=  15 prim: GENERALIZEDTIME   :20151028204239Z&lt;br /&gt;
  182:d=3  hl=2 l=  15 prim: GENERALIZEDTIME   :20251025204239Z&lt;br /&gt;
  199:d=2  hl=2 l= 127 cons: SEQUENCE          &lt;br /&gt;
  201:d=3  hl=2 l=  11 cons: SET               &lt;br /&gt;
  203:d=4  hl=2 l=   9 cons: SEQUENCE          &lt;br /&gt;
  205:d=5  hl=2 l=   3 prim: OBJECT            :countryName&lt;br /&gt;
  210:d=5  hl=2 l=   2 prim: PRINTABLESTRING   :FR&lt;br /&gt;
  214:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
  216:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
  218:d=5  hl=2 l=   3 prim: OBJECT            :commonName&lt;br /&gt;
  223:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  244:d=3  hl=2 l=  28 cons: SET               &lt;br /&gt;
  246:d=4  hl=2 l=  26 cons: SEQUENCE          &lt;br /&gt;
  248:d=5  hl=2 l=   3 prim: OBJECT            :organizationName&lt;br /&gt;
  253:d=5  hl=2 l=  19 prim: PRINTABLESTRING   :pavilionartlogiciel&lt;br /&gt;
  274:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  276:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  278:d=5  hl=2 l=   3 prim: OBJECT            :organizationalUnitName&lt;br /&gt;
  283:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  292:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  294:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  296:d=5  hl=2 l=   3 prim: OBJECT            :stateOrProvinceName&lt;br /&gt;
  301:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  310:d=3  hl=2 l=  16 cons: SET               &lt;br /&gt;
  312:d=4  hl=2 l=  14 cons: SEQUENCE          &lt;br /&gt;
  314:d=5  hl=2 l=   3 prim: OBJECT            :localityName&lt;br /&gt;
  319:d=5  hl=2 l=   7 prim: PRINTABLESTRING   :Unknown&lt;br /&gt;
  328:d=2  hl=4 l= 290 cons: SEQUENCE          &lt;br /&gt;
  332:d=3  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
  334:d=4  hl=2 l=   9 prim: OBJECT            :rsaEncryption&lt;br /&gt;
  345:d=4  hl=2 l=   0 prim: NULL              &lt;br /&gt;
  347:d=3  hl=4 l= 271 prim: BIT STRING        &lt;br /&gt;
  622:d=2  hl=2 l=  85 cons: cont [ 3 ]        &lt;br /&gt;
  624:d=3  hl=2 l=  83 cons: SEQUENCE          &lt;br /&gt;
  626:d=4  hl=2 l=  12 cons: SEQUENCE          &lt;br /&gt;
  628:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Basic Constraints&lt;br /&gt;
  633:d=5  hl=2 l=   1 prim: BOOLEAN           :255&lt;br /&gt;
  636:d=5  hl=2 l=   2 prim: OCTET STRING      [HEX DUMP]:3000&lt;br /&gt;
  640:d=4  hl=2 l=  19 cons: SEQUENCE          &lt;br /&gt;
  642:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Extended Key Usage&lt;br /&gt;
  647:d=5  hl=2 l=  12 prim: OCTET STRING      [HEX DUMP]:300A06082B06010505070301&lt;br /&gt;
  661:d=4  hl=2 l=  15 cons: SEQUENCE          &lt;br /&gt;
  663:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Key Usage&lt;br /&gt;
  668:d=5  hl=2 l=   1 prim: BOOLEAN           :255&lt;br /&gt;
  671:d=5  hl=2 l=   5 prim: OCTET STRING      [HEX DUMP]:0303072000&lt;br /&gt;
  678:d=4  hl=2 l=  29 cons: SEQUENCE          &lt;br /&gt;
  680:d=5  hl=2 l=   3 prim: OBJECT            :X509v3 Subject Key Identifier&lt;br /&gt;
  685:d=5  hl=2 l=  22 prim: OCTET STRING      [HEX DUMP]:0414304610060805E69AE14F84CC366012C0EB9E3D99&lt;br /&gt;
  709:d=1  hl=2 l=  13 cons: SEQUENCE          &lt;br /&gt;
  711:d=2  hl=2 l=   9 prim: OBJECT            :sha1WithRSAEncryption&lt;br /&gt;
  722:d=2  hl=2 l=   0 prim: NULL              &lt;br /&gt;
  724:d=1  hl=4 l= 257 prim: BIT STRING   &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
since it is a X509 certificate the best way to view content is &lt;br /&gt;
&lt;br /&gt;
openssl x509 -in dumpcertfile -inform DER -text&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Encoding]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=File:BIO_f_md_filter.png&amp;diff=2313</id>
		<title>File:BIO f md filter.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=File:BIO_f_md_filter.png&amp;diff=2313"/>
		<updated>2015-10-18T20:35:31Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: Graphical Artwork extracted from a future presenation.
I created it, use at your will.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Graphical Artwork extracted from a future presenation.&lt;br /&gt;
I created it, use at your will.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Base64&amp;diff=2311</id>
		<title>Base64</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Base64&amp;diff=2311"/>
		<updated>2015-10-17T11:34:56Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: openssl base64 specificities&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Encode binary information 8 bits into ASCII.&lt;br /&gt;
&lt;br /&gt;
This is PEM base encode, it exists other base64 encoding scheme like this uses by crypt.&lt;br /&gt;
&lt;br /&gt;
== Algorithm ==&lt;br /&gt;
&lt;br /&gt;
3 x 8 bits binary are concatenated to form a 24bits word that is split in 4 x 6bits each being translating into an ascii value using a character ordered in following list :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ &lt;br /&gt;
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||&lt;br /&gt;
0000000000111111111122222222223333333333444444444455555555556666&lt;br /&gt;
0123456789012345678901234567890123456789012345678901234567890123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[what makes 26 * 2 + 10 + 2 = 64 values]&lt;br /&gt;
&lt;br /&gt;
Since it encodes by group of 3 bytes, when last group of 3 bytes miss one byte then = is used, when it miss 2 bytes then == is used for padding.&lt;br /&gt;
&lt;br /&gt;
== Openssl command ==&lt;br /&gt;
&lt;br /&gt;
base64 or -enc base64 can be used to decode lines see [[Command_Line_Utilities]]&lt;br /&gt;
&lt;br /&gt;
== EVP API ==&lt;br /&gt;
&lt;br /&gt;
crypto/evp/encode.c&lt;br /&gt;
crypto/evp/bio_b64.C&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== WARNINGS ===&lt;br /&gt;
&lt;br /&gt;
=== other unsupported base64 scheme ===&lt;br /&gt;
&lt;br /&gt;
Warning crypt() password encryption function uses another base64 scheme which is not the openssl base64 one. :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&lt;br /&gt;
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||&lt;br /&gt;
0000000000111111111122222222223333333333444444444455555555556666&lt;br /&gt;
0123456789012345678901234567890123456789012345678901234567890123&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== base64 uses PEM 80 characters per line ===&lt;br /&gt;
&lt;br /&gt;
Base64 itself does not impose a line split, but openssl uses it in PEM context hence enforce that base64 content is splitted by lines with a maximum of 80 characters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Encoding]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=History_And_People&amp;diff=2303</id>
		<title>History And People</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=History_And_People&amp;diff=2303"/>
		<updated>2015-10-14T19:31:53Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
OpenSSL is there because people decided to fork and maintain it.&lt;br /&gt;
&lt;br /&gt;
It would be valuable to get some information about people behind openssl.&lt;br /&gt;
&lt;br /&gt;
Here a list of people i (see history of this page to know who i ami since i am not in this list) believe would have an history for current history (2014 2015) of OpenSSL.&lt;br /&gt;
&lt;br /&gt;
( I created this page with a hidden agenda to prepare for 28th November a presentation in french in a Linux local event, but this might have a higher value ).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- Initial creator&lt;br /&gt;
Eric Andrew Young and Tim Hudson&lt;br /&gt;
&lt;br /&gt;
- OpenSSL foundation  ( and not already cited )&lt;br /&gt;
Dr. Steve Henson&lt;br /&gt;
Richard Levitte&lt;br /&gt;
Steve Marquess&lt;br /&gt;
Rich Salz&lt;br /&gt;
&lt;br /&gt;
Official developers ( and not already cited )&lt;br /&gt;
Matt Caswell&lt;br /&gt;
Mark J. Cox&lt;br /&gt;
Viktor Dukhovni&lt;br /&gt;
Lutz Jänicke&lt;br /&gt;
Emilia Käsper&lt;br /&gt;
Ben Laurie&lt;br /&gt;
Steve Marquess&lt;br /&gt;
Richard Levitte&lt;br /&gt;
Bodo Möller&lt;br /&gt;
Andy Polyakov&lt;br /&gt;
Kurt Roeckx &lt;br /&gt;
Geoff Thorpe&lt;br /&gt;
&lt;br /&gt;
And valuable 2015 contributors :&lt;br /&gt;
&lt;br /&gt;
Jonas Maebe&lt;br /&gt;
Felix Laurie von Massenbach&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don't feel offended if you are not cited here, if you consider to have something usefull to add you anyway will have more inner view than i am.&lt;br /&gt;
&lt;br /&gt;
Here a possible set of question :&lt;br /&gt;
&lt;br /&gt;
- Why did you come to this project ?&lt;br /&gt;
- What is your focus area on this project ?&lt;br /&gt;
- How did you feel about heartbleed ?&lt;br /&gt;
- Why do you stay ?&lt;br /&gt;
- What is your dream for OpenSSL future ?&lt;br /&gt;
- Are there things you would do differently now than before – a specific CVE event affected a piece of code you were directly or indirectly involved - . ?&lt;br /&gt;
- Anything else that you find relevant.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=History_And_People&amp;diff=2302</id>
		<title>History And People</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=History_And_People&amp;diff=2302"/>
		<updated>2015-10-14T18:48:11Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
OpenSSL is there because people decided to fork and maintain it.&lt;br /&gt;
&lt;br /&gt;
I would be valuable to get some information about people behind openssl.&lt;br /&gt;
&lt;br /&gt;
Here a list of people i (see history of this page to know who i ami since i am not in this list) believe would have an history for current history (2014 2015) of OpenSSL.&lt;br /&gt;
&lt;br /&gt;
( I created this page with a hidden agenda to prepare for 28th November a presentation in french in a Linux local event, but this might have a higher value ).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- Initial creator&lt;br /&gt;
Eric Andrew Young and Tim Hudson&lt;br /&gt;
&lt;br /&gt;
- OpenSSL foundation  ( and not already cited )&lt;br /&gt;
Dr. Steve Henson&lt;br /&gt;
Richard Levitte&lt;br /&gt;
Steve Marquess&lt;br /&gt;
Rich Salz&lt;br /&gt;
&lt;br /&gt;
Official developers ( and not already cited )&lt;br /&gt;
Matt Caswell&lt;br /&gt;
Mark J. Cox&lt;br /&gt;
Viktor Dukhovni&lt;br /&gt;
Lutz Jänicke&lt;br /&gt;
Emilia Käsper&lt;br /&gt;
Ben Laurie&lt;br /&gt;
Steve Marquess&lt;br /&gt;
Richard Levitte&lt;br /&gt;
Bodo Möller&lt;br /&gt;
Andy Polyakov&lt;br /&gt;
Kurt Roeckx &lt;br /&gt;
Geoff Thorpe&lt;br /&gt;
&lt;br /&gt;
And valuable 2015 contributors :&lt;br /&gt;
&lt;br /&gt;
Jonas Maebe&lt;br /&gt;
Felix Laurie von Massenbach&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don't feel offended if you are not cited here, if you consider to have something usefull to add you anyway will have more inner view than i am.&lt;br /&gt;
&lt;br /&gt;
Here a possible set of question :&lt;br /&gt;
&lt;br /&gt;
- Why did you come to this project ?&lt;br /&gt;
- What is your focus area on this project ?&lt;br /&gt;
- How did you feel about heartbleed ?&lt;br /&gt;
- Why do you stay ?&lt;br /&gt;
- What is your dream for OpenSSL future ?&lt;br /&gt;
- Are there things you would do differently now than before – a specific CVE event affected a piece of code you were directly or indirectly involved - . ?&lt;br /&gt;
- Anything else that you find relevant.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=History_And_People&amp;diff=2301</id>
		<title>History And People</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=History_And_People&amp;diff=2301"/>
		<updated>2015-10-14T18:47:30Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
OpenSSL is there because people decided to fork and maintain it.&lt;br /&gt;
&lt;br /&gt;
I would be valuable to get some information about people behind openssl.&lt;br /&gt;
&lt;br /&gt;
Here a list of people i (see history of this page to know who i ami since i am not in this list) believe would have an history for current history of OpenSSL.&lt;br /&gt;
&lt;br /&gt;
( I created this page with a hidden agenda to prepare for 28th November a presentation in french in a Linux local event, but this might have a higher value ).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- Initial creator&lt;br /&gt;
Eric Andrew Young and Tim Hudson&lt;br /&gt;
&lt;br /&gt;
- OpenSSL foundation  ( and not already cited )&lt;br /&gt;
Dr. Steve Henson&lt;br /&gt;
Richard Levitte&lt;br /&gt;
Steve Marquess&lt;br /&gt;
Rich Salz&lt;br /&gt;
&lt;br /&gt;
Official developers ( and not already cited )&lt;br /&gt;
Matt Caswell&lt;br /&gt;
Mark J. Cox&lt;br /&gt;
Viktor Dukhovni&lt;br /&gt;
Lutz Jänicke&lt;br /&gt;
Emilia Käsper&lt;br /&gt;
Ben Laurie&lt;br /&gt;
Steve Marquess&lt;br /&gt;
Richard Levitte&lt;br /&gt;
Bodo Möller&lt;br /&gt;
Andy Polyakov&lt;br /&gt;
Kurt Roeckx &lt;br /&gt;
Geoff Thorpe&lt;br /&gt;
&lt;br /&gt;
And valuable 2015 contributors :&lt;br /&gt;
&lt;br /&gt;
Jonas Maebe&lt;br /&gt;
Felix Laurie von Massenbach&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Don't feel offended if you are not cited here, if you consider to have something usefull to add you anyway will have more inner view than i am.&lt;br /&gt;
&lt;br /&gt;
Here a possible set of question :&lt;br /&gt;
&lt;br /&gt;
- Why did you come to this project ?&lt;br /&gt;
- What is your focus area on this project ?&lt;br /&gt;
- How did you feel about heartbleed ?&lt;br /&gt;
- Why do you stay ?&lt;br /&gt;
- What is your dream for OpenSSL future ?&lt;br /&gt;
- Are there things you would do differently now than before – a specific CVE event affected a piece of code you were directly or indirectly involved - . ?&lt;br /&gt;
- Anything else that you find relevant.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=History_And_People&amp;diff=2300</id>
		<title>History And People</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=History_And_People&amp;diff=2300"/>
		<updated>2015-10-14T18:47:05Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: Who are OpenSSL humans ?&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
OpenSSL is there because people decided to fork and maintain it.&lt;br /&gt;
&lt;br /&gt;
I would be valuable to get some information about people behind openssl.&lt;br /&gt;
&lt;br /&gt;
Here a list of people i (see history of this page to know who i ami since i am not in this list) believe would have an history for current history of OpenSSL.&lt;br /&gt;
&lt;br /&gt;
( I created this page with a hidden agenda to prepare for 28th November a presentation in french in a Linux local event, but this might have a higher value ).&lt;br /&gt;
&lt;br /&gt;
- Initial creator&lt;br /&gt;
Eric Andrew Young and Tim Hudson&lt;br /&gt;
&lt;br /&gt;
- OpenSSL foundation  ( and not already cited )&lt;br /&gt;
Dr. Steve Henson&lt;br /&gt;
Richard Levitte&lt;br /&gt;
Steve Marquess&lt;br /&gt;
Rich Salz&lt;br /&gt;
&lt;br /&gt;
Official developers ( and not already cited )&lt;br /&gt;
Matt Caswell&lt;br /&gt;
Mark J. Cox&lt;br /&gt;
Viktor Dukhovni&lt;br /&gt;
Lutz Jänicke&lt;br /&gt;
Emilia Käsper&lt;br /&gt;
Ben Laurie&lt;br /&gt;
Steve Marquess&lt;br /&gt;
Richard Levitte&lt;br /&gt;
Bodo Möller&lt;br /&gt;
Andy Polyakov&lt;br /&gt;
Kurt Roeckx &lt;br /&gt;
Geoff Thorpe&lt;br /&gt;
&lt;br /&gt;
And valuable 2015 contributors :&lt;br /&gt;
&lt;br /&gt;
Jonas Maebe&lt;br /&gt;
Felix Laurie von Massenbach&lt;br /&gt;
&lt;br /&gt;
Don't feel offended if you are not cited here, if you consider to have something usefull to add you anyway will have more inner view than i am.&lt;br /&gt;
&lt;br /&gt;
Here a possible set of question :&lt;br /&gt;
&lt;br /&gt;
- Why did you come to this project ?&lt;br /&gt;
- What is your focus area on this project ?&lt;br /&gt;
- How did you feel about heartbleed ?&lt;br /&gt;
- Why do you stay ?&lt;br /&gt;
- What is your dream for OpenSSL future ?&lt;br /&gt;
- Are there things you would do differently now than before – a specific CVE event affected a piece of code you were directly or indirectly involved - . ?&lt;br /&gt;
- Anything else that you find relevant.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=OpenSSL_Overview&amp;diff=2299</id>
		<title>OpenSSL Overview</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=OpenSSL_Overview&amp;diff=2299"/>
		<updated>2015-10-14T18:38:05Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Command Line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OpenSSL is a versatile tool that can be used for many purposes.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides:&lt;br /&gt;
&lt;br /&gt;
* A command line application to perform a wide variety of cryptography tasks, such as creating and handling certificates and related files. [[Command_Line_Utilities|OpenSSL commands]]&lt;br /&gt;
* A comprehensive and extensive cryptographic library [[Libcrypto_API|libcrypto]].&lt;br /&gt;
* A library for enabling SSL/TLS communications [[Libssl_API|libssl]] to provide [[SSL and TLS Protocols]] support within clients or servers applications.&lt;br /&gt;
&lt;br /&gt;
== Command Line ==&lt;br /&gt;
&lt;br /&gt;
Example uses of the OpenSSL command line tool include:&lt;br /&gt;
* Creating and handling certificates and related files. [[Command_Line_Utilities|openssl commands]]. A beginners introduction to certificates is on the [[Certificate Lifecycle]] page.&lt;br /&gt;
* Testing of SSL/TLS protocols (openssl s_server, openssl s_client).&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
[[History And People]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Beginner]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Compilation_and_Installation&amp;diff=2188</id>
		<title>Compilation and Installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Compilation_and_Installation&amp;diff=2188"/>
		<updated>2015-03-22T19:27:43Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Retrieve source code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Retrieve source code ==&lt;br /&gt;
&lt;br /&gt;
The OpenSSL source code can be downloaded from [http://www.openssl.org/source/ www.openssl.org/source/] or any suitable [http://www.openssl.org/source/mirror.html ftp mirror]. There are various versions including stable as well as unstable versions. &lt;br /&gt;
&lt;br /&gt;
The source code is managed via Git, the repository is&lt;br /&gt;
&lt;br /&gt;
: git://git.openssl.org/openssl.git&lt;br /&gt;
&lt;br /&gt;
The source is also available via a [https://github.com/openssl/openssl GitHub] mirror. This repository is updated every 15 minutes.&lt;br /&gt;
&lt;br /&gt;
* [[Use_of_Git|Accessing OpenSSL source code via Git]]&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
OpenSSL is configured for a particular platform with protocol and behavior options using &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Configure &amp;amp; Config ===&lt;br /&gt;
&lt;br /&gt;
You use &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt; to tune the compile and installation process through options and switches. The difference between is &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; properly handles the host-arch-compiler triplet, and &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt; does not. &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt; attempts to guess the triplet, so its a lot like autotool's &amp;lt;tt&amp;gt;config.guess&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
You can usually use &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt; and it will do the right thing (from Ubuntu 13.04, x64):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ./config &lt;br /&gt;
Operating system: x86_64-whatever-linux2&lt;br /&gt;
Configuring for linux-x86_64&lt;br /&gt;
Configuring for linux-x86_64&lt;br /&gt;
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)&lt;br /&gt;
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)&lt;br /&gt;
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)&lt;br /&gt;
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5&lt;br /&gt;
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)&lt;br /&gt;
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)&lt;br /&gt;
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)&lt;br /&gt;
    no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)&lt;br /&gt;
    no-shared       [default] &lt;br /&gt;
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)&lt;br /&gt;
    no-zlib         [default] &lt;br /&gt;
    no-zlib-dynamic [default] &lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mac OSX is a problem (its often a neglected platform), and you will have to use &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt; ./Configure darwin64-x86_64-cc&lt;br /&gt;
Configuring for darwin64-x86_64-cc&lt;br /&gt;
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)&lt;br /&gt;
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)&lt;br /&gt;
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)&lt;br /&gt;
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5&lt;br /&gt;
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)&lt;br /&gt;
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)&lt;br /&gt;
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)&lt;br /&gt;
    no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)&lt;br /&gt;
    no-shared       [default] &lt;br /&gt;
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)&lt;br /&gt;
    no-zlib         [default] &lt;br /&gt;
    no-zlib-dynamic [default]&lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Running the same command with &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt; results in:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ./config darwin64-x86_64-cc&lt;br /&gt;
Operating system: i686-apple-darwinDarwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64&lt;br /&gt;
WARNING! If you wish to build 64-bit library, then you have to&lt;br /&gt;
         invoke './Configure darwin64-x86_64-cc' *manually*.&lt;br /&gt;
         You have about 5 seconds to press Ctrl-C to abort.&lt;br /&gt;
Configuring for darwin-i386-cc&lt;br /&gt;
target already defined - darwin-i386-cc (offending arg: darwin64-x86_64-cc)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can also configure on Darwin by exporting &amp;lt;tt&amp;gt;KERNEL_BITS&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ export KERNEL_BITS=64&lt;br /&gt;
$ ./config shared no-ssl2 enable-ec_nistp_64_gcc_128 --openssldir=/usr/local/ssl/macosx-x64/&lt;br /&gt;
Operating system: i686-apple-darwinDarwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64&lt;br /&gt;
Configuring for darwin64-x86_64-cc&lt;br /&gt;
Configuring for darwin64-x86_64-cc&lt;br /&gt;
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)&lt;br /&gt;
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)&lt;br /&gt;
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5&lt;br /&gt;
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)&lt;br /&gt;
    no-psk          [option]   OPENSSL_NO_PSK (skip dir)&lt;br /&gt;
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)&lt;br /&gt;
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)&lt;br /&gt;
    no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)&lt;br /&gt;
    no-srp          [option]   OPENSSL_NO_SRP (skip dir)&lt;br /&gt;
    no-ssl2         [option]   OPENSSL_NO_SSL2 (skip dir)&lt;br /&gt;
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)&lt;br /&gt;
    no-zlib         [default] &lt;br /&gt;
    no-zlib-dynamic [default] &lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you provide a option not known to configure or ask for help, then you get a brief help message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ./Configure --help&lt;br /&gt;
Usage: Configure [no-&amp;lt;cipher&amp;gt; ...] [enable-&amp;lt;cipher&amp;gt; ...] [experimental-&amp;lt;cipher&amp;gt; ...]&lt;br /&gt;
[-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared]&lt;br /&gt;
[[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR]&lt;br /&gt;
[--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And if you supply an unknown triplet: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ./Configure darwin64-x86_64-clang&lt;br /&gt;
Configuring for darwin64-x86_64-clang&lt;br /&gt;
Usage: Configure [no-&amp;lt;cipher&amp;gt; ...] [enable-&amp;lt;cipher&amp;gt; ...] [experimental-&amp;lt;cipher&amp;gt; ...]&lt;br /&gt;
[-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared]&lt;br /&gt;
[[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR]&lt;br /&gt;
[--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags]&lt;br /&gt;
&lt;br /&gt;
pick os/compiler from:&lt;br /&gt;
BC-32 BS2000-OSD BSD-generic32 BSD-generic64 BSD-ia64 BSD-sparc64 BSD-sparcv8 &lt;br /&gt;
BSD-x86 BSD-x86-elf BSD-x86_64 Cygwin Cygwin-pre1.3 DJGPP MPE/iX-gcc OS2-EMX &lt;br /&gt;
OS390-Unix QNX6 QNX6-i386 ReliantUNIX SINIX SINIX-N UWIN VC-CE VC-WIN32 &lt;br /&gt;
VC-WIN64A VC-WIN64I aix-cc aix-gcc aix3-cc aix64-cc aix64-gcc android &lt;br /&gt;
android-armv7 android-x86 aux3-gcc beos-x86-bone beos-x86-r5 bsdi-elf-gcc cc &lt;br /&gt;
cray-j90 cray-t3e darwin-i386-cc darwin-ppc-cc darwin64-ppc-cc &lt;br /&gt;
darwin64-x86_64-cc dgux-R3-gcc dgux-R4-gcc dgux-R4-x86-gcc dist gcc hpux-cc &lt;br /&gt;
hpux-gcc hpux-ia64-cc hpux-ia64-gcc hpux-parisc-cc hpux-parisc-cc-o4 &lt;br /&gt;
hpux-parisc-gcc hpux-parisc1_1-cc hpux-parisc1_1-gcc hpux-parisc2-cc &lt;br /&gt;
hpux-parisc2-gcc hpux64-ia64-cc hpux64-ia64-gcc hpux64-parisc2-cc &lt;br /&gt;
hpux64-parisc2-gcc hurd-x86 iphoneos-cross irix-cc irix-gcc irix-mips3-cc &lt;br /&gt;
irix-mips3-gcc irix64-mips4-cc irix64-mips4-gcc linux-alpha+bwx-ccc &lt;br /&gt;
linux-alpha+bwx-gcc linux-alpha-ccc linux-alpha-gcc linux-aout linux-armv4 &lt;br /&gt;
linux-elf linux-generic32 linux-generic64 linux-ia32-icc linux-ia64 &lt;br /&gt;
linux-ia64-ecc linux-ia64-icc linux-ppc linux-ppc64 linux-sparcv8 &lt;br /&gt;
linux-sparcv9 linux-x86_64 linux32-s390x linux64-s390x linux64-sparcv9 mingw &lt;br /&gt;
mingw64 ncr-scde netware-clib netware-clib-bsdsock netware-clib-bsdsock-gcc &lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
NOTE: If in doubt, on Unix-ish systems use './config'.&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, to delete a configuration and start anew, run &amp;lt;tt&amp;gt;make dclean&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Configure Options ===&lt;br /&gt;
&lt;br /&gt;
OpenSSL has been around a long time, and it carries around a lot of cruft. For example, from above, SSLv2 is enabled by default. SSLv2 is completely broken, and you should disable it during configuration. You can disable protocols and provide other options through &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt;, and the following lists some of them.&lt;br /&gt;
&lt;br /&gt;
'''Note''': if you specify a non-existent option, then the configure scripts will proceed without warning. For example, if you inadvertently specify '''no-sslv2''' rather than '''no-ssl2''', the script will configure ''with'' SSLv2 and ''without'' warning for the unknown no-sslv2.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ OpenSSL Library Options&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Option&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| --openssldir=XXX || The installation directory. If not specified, the library will be installed at &amp;lt;tt&amp;gt;/usr/local/ssl&amp;lt;/tt&amp;gt;. Header will be located at &amp;lt;tt&amp;gt;/usr/local/ssl/include/openssl&amp;lt;/tt&amp;gt;, and libraries located at &amp;lt;tt&amp;gt;/usr/local/ssl/lib&amp;lt;/tt&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| shared || Build a shared object in addition to the static archive&lt;br /&gt;
|-&lt;br /&gt;
| enable-ec_nistp_64_gcc_128 || Use on x64 platforms when GCC supports &amp;lt;tt&amp;gt;__uint128_t&amp;lt;/tt&amp;gt;. ECDH is about 2 to 4 times faster. Not enabled by default because &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; can't determine it.&lt;br /&gt;
|-&lt;br /&gt;
| no-ssl2 || Disables SSLv2. &amp;lt;tt&amp;gt;OPENSSL_NO_SSL2&amp;lt;/tt&amp;gt; will be defined in the OpenSSL headers.&lt;br /&gt;
|-&lt;br /&gt;
| no-ssl3 || Disables SSLv3. &amp;lt;tt&amp;gt;OPENSSL_NO_SSL3&amp;lt;/tt&amp;gt; will be defined in the OpenSSL headers.&lt;br /&gt;
|-&lt;br /&gt;
| no-comp || Disables compression independent of &amp;lt;tt&amp;gt;zlib&amp;lt;/tt&amp;gt;. &amp;lt;tt&amp;gt;OPENSSL_NO_COMP&amp;lt;/tt&amp;gt; will be defined in the OpenSSL headers.&lt;br /&gt;
|-&lt;br /&gt;
| no-idea || Disables IDEA algorithm. Unlike RC5 and MDC2, IDEA is enabled by default&lt;br /&gt;
|-&lt;br /&gt;
| no-asm || Disables assembly language routines (and uses C routines)&lt;br /&gt;
|-&lt;br /&gt;
| no-dtls || Disables DTLS (useful on mobile devices since carriers often block UDP)&lt;br /&gt;
|-&lt;br /&gt;
| no-shared || Disables shared objects (only a static library is created)&lt;br /&gt;
|-&lt;br /&gt;
| no-hw || Disables hardware support (useful on mobile devices)&lt;br /&gt;
|-&lt;br /&gt;
| no-engines || Disables hardware support (useful on mobile devices)&lt;br /&gt;
|-&lt;br /&gt;
| no-threads || Disables threading support&lt;br /&gt;
|-&lt;br /&gt;
| no-dso || Disables the OpenSSL DSO API (the library offers a shared object abstraction layer)&lt;br /&gt;
|-&lt;br /&gt;
| no-err || Removes all error function names and error reason text to reduce footprint&lt;br /&gt;
|-&lt;br /&gt;
| no-npn || Disables Next Protocol Negotiation (NPN)&lt;br /&gt;
|-&lt;br /&gt;
| no-psk || Disables Preshared Key (PSK). PSK provides mutual authentication independent of trusted authorities, but its rarely offered or used&lt;br /&gt;
|-&lt;br /&gt;
| no-srp || Disables Secure Remote Password (SRP). SRP provides mutual authentication independent of trusted authorities, but its rarely offered or used&lt;br /&gt;
|-&lt;br /&gt;
| no-ec2m || Used when configuring FIPS Capable Library with a FIPS Object Module that only includes prime curves. That is, use this switch if you use &amp;lt;tt&amp;gt;openssl-fips-ecp-2.0.5&amp;lt;/tt&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| -DXXX || Defines XXX. For example, &amp;lt;tt&amp;gt;-DOPENSSL_NO_HEARTBEATS&amp;lt;/tt&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| -DOPENSSL_USE_IPV6=0 || Disables IPv6. Useful if OpenSSL encounters incorrect or inconsistent platform headers and mistakenly enables IPv6. Must be passed to &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; manually.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
After disabling an option, your configure output will look similar to below (notice the lack of SSLv2 and SSLv3 support).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ./Configure darwin64-x86_64-cc no-ssl2 no-ssl3&lt;br /&gt;
Configuring for darwin64-x86_64-cc&lt;br /&gt;
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)&lt;br /&gt;
    no-gmp          [default]  OPENSSL_NO_GMP (skip dir)&lt;br /&gt;
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)&lt;br /&gt;
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5&lt;br /&gt;
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)&lt;br /&gt;
    no-rc5          [default]  OPENSSL_NO_RC5 (skip dir)&lt;br /&gt;
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (skip dir)&lt;br /&gt;
    no-sctp         [default]  OPENSSL_NO_SCTP (skip dir)&lt;br /&gt;
    no-shared       [default] &lt;br /&gt;
    no-ssl2         [option]   OPENSSL_NO_SSL2 (skip dir)&lt;br /&gt;
    no-ssl3         [option]   OPENSSL_NO_SSL3 (skip dir)&lt;br /&gt;
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)&lt;br /&gt;
    no-zlib         [default] &lt;br /&gt;
    no-zlib-dynamic [default] &lt;br /&gt;
    ...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Compile Time Checking ===&lt;br /&gt;
&lt;br /&gt;
If you disable an option during configure, you can check if it's available through &amp;lt;tt&amp;gt;OPENSSL_NO_*&amp;lt;/tt&amp;gt; defines. OpenSSL writes the configure options to &amp;lt;tt&amp;gt;&amp;lt;openssl/opensslconf.h&amp;gt;&amp;lt;/tt&amp;gt;. For example, if you want to know if SSLv3 is available, then you would perform the following in your code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;#include &amp;lt;openssl/opensslconf.h&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
#if !defined(OPENSSL_NO_SSL3)&lt;br /&gt;
  /* SSLv3 is available */&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Modifying Build Settings ===&lt;br /&gt;
&lt;br /&gt;
Sometimes you need to work around OpenSSL's selections for building the library. For example, you might want to use &amp;lt;tt&amp;gt;-Os&amp;lt;/tt&amp;gt; for a mobile device (rather than &amp;lt;tt&amp;gt;-O3&amp;lt;/tt&amp;gt;), or you might want to use the &amp;lt;tt&amp;gt;clang&amp;lt;/tt&amp;gt; compiler (rather than &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
In case like these, its often easier to modify &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Makefile.org&amp;lt;/tt&amp;gt; rather than trying to add targets to the configure scripts. Below is a patch that modifies &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Makefile.org&amp;lt;/tt&amp;gt; for use under the iOS 7.0 SDK (which lacks &amp;lt;tt&amp;gt;gcc&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/&amp;lt;/tt&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* Modifies &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; to use &amp;lt;tt&amp;gt;clang&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Modifies &amp;lt;tt&amp;gt;Makefile.org&amp;lt;/tt&amp;gt; to use &amp;lt;tt&amp;gt;clang&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Modifies &amp;lt;tt&amp;gt;CFLAG&amp;lt;/tt&amp;gt; to use &amp;lt;tt&amp;gt;-Os&amp;lt;/tt&amp;gt;&lt;br /&gt;
* Modifies &amp;lt;tt&amp;gt;MAKEDEPPROG&amp;lt;/tt&amp;gt; to use &amp;lt;tt&amp;gt;$(CC) -M&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Setting and resetting of &amp;lt;tt&amp;gt;LANG&amp;lt;/tt&amp;gt; is required on Mac OSX to work around a &amp;lt;tt&amp;gt;sed&amp;lt;/tt&amp;gt; bug or limitation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;OLD_LANG=$LANG&lt;br /&gt;
unset LANG&lt;br /&gt;
&lt;br /&gt;
sed -i &amp;quot;&amp;quot; 's|\&amp;quot;iphoneos-cross\&amp;quot;\,\&amp;quot;llvm-gcc\:-O3|\&amp;quot;iphoneos-cross\&amp;quot;\,\&amp;quot;clang\:-Os|g' Configure&lt;br /&gt;
sed -i &amp;quot;&amp;quot; 's/CC= cc/CC= clang/g' Makefile.org&lt;br /&gt;
sed -i &amp;quot;&amp;quot; 's/CFLAG= -O/CFLAG= -Os/g' Makefile.org&lt;br /&gt;
sed -i &amp;quot;&amp;quot; 's/MAKEDEPPROG=makedepend/MAKEDEPPROG=$(CC) -M/g' Makefile.org&lt;br /&gt;
&lt;br /&gt;
export LANG=$OLD_LANG&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After modification, be sure to dclean and configure again so the new settings are picked up:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;make dclean&lt;br /&gt;
&lt;br /&gt;
./config&lt;br /&gt;
make depend&lt;br /&gt;
make all&lt;br /&gt;
...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Fedora and Red Hat ===&lt;br /&gt;
&lt;br /&gt;
On Fedora and Red Hat systems, be sure to export &amp;lt;tt&amp;gt;CFLAGS=&amp;quot;-fPIC&amp;quot;&amp;lt;/tt&amp;gt; and explicitly specify &amp;lt;tt&amp;gt;shared&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;config&amp;lt;/tt&amp;gt;. Failing to do so will result in static libraries only.That is, you will be missing the shared objects and engines. The commands would look similar to below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;$ export CFLAGS=&amp;quot;-fPIC&amp;quot;&lt;br /&gt;
$ ./config shared no-ssl2 no-ssl3 --openssldir=/usr/local/ssl&lt;br /&gt;
...&lt;br /&gt;
$ make depend&lt;br /&gt;
...&lt;br /&gt;
$ make all&lt;br /&gt;
...&lt;br /&gt;
$ sudo -E make install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== FIPS Capable Library ===&lt;br /&gt;
&lt;br /&gt;
If you want to use FIPS validated cryptography, you download, build and install the FIPS Object Module (&amp;lt;tt&amp;gt;openssl-fips-2.0.5.tar.gz&amp;lt;/tt&amp;gt;) according to the [https://www.openssl.org/docs/fips/UserGuide-2.0.pdf FIPS User Guide 2.0] and [https://www.openssl.org/docs/fips/SecurityPolicy-2.0.pdf FIPS 140-2 Security Policy]. You then download, build and install the FIPS Capable Library (&amp;lt;tt&amp;gt;openssl-1.0.1e.tar.gz&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
When configuring the FIPS Capable Library, you must use &amp;lt;tt&amp;gt;fips&amp;lt;/tt&amp;gt; as an option:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./config fips &amp;lt;other options ...&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you are configuring the FIPS Capable Library with only prime curves (&amp;lt;tt&amp;gt;openssl-fips-ecp-2.0.5.tar.gz&amp;lt;/tt&amp;gt;), then you must configure with &amp;lt;tt&amp;gt;no-ec2m&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./config fips no-ec2m &amp;lt;other options ...&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Compilation ==&lt;br /&gt;
&lt;br /&gt;
Once you untar the source files (or fetched them from source control), its a good idea to look at README provided in it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cat README&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where you will understand that you have to read another file INSTALL :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;cat INSTALL&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Depending on your platform you will have to pick up the right INSTALL by example INSTALL.W64.&lt;br /&gt;
Default is for Unix based systems.&lt;br /&gt;
&lt;br /&gt;
==== Quick ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./config &amp;lt;nowiki&amp;gt;&amp;lt;options ...&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
make depend&lt;br /&gt;
make&lt;br /&gt;
make test&lt;br /&gt;
make install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Various options can be found examining the &amp;lt;tt&amp;gt;Configure&amp;lt;/tt&amp;gt; file (there is a well commented block at its top). OpenSSL ships with SSLv2, SSLv3 and Compression enabled by default (see &amp;lt;tt&amp;gt;my $disabled&amp;lt;/tt&amp;gt;), so you might want to use &amp;lt;tt&amp;gt;no-ssl2&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;no-ssl3&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;no-comp&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Platfom specific ==&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
==== Intel ====&lt;br /&gt;
&lt;br /&gt;
==== ARM ====&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
3noch wrote a VERY good guide [http://developer.covenanteyes.com/building-openssl-for-visual-studio/ here].&lt;br /&gt;
Like he said in his article, make absolutely sure to create separate directories for 32 and 64 bit versions.&lt;br /&gt;
&lt;br /&gt;
==== W32 / Windows NT - Windows 9x ====&lt;br /&gt;
&lt;br /&gt;
type INSTALL.W32&lt;br /&gt;
&lt;br /&gt;
* you need Perl for Win32.  Unless you will build on Cygwin, you will need ActiveState Perl, available from http://www.activestate.com/ActivePerl.&lt;br /&gt;
* one of the following C compilers:&lt;br /&gt;
** Visual C++&lt;br /&gt;
** Borland C&lt;br /&gt;
** GNU C (Cygwin or MinGW)&lt;br /&gt;
* Netwide Assembler, a.k.a. NASM, available from http://nasm.sourceforge.net/ is required if you intend to utilize assembler modules. Note that NASM is now the only supported assembler.&lt;br /&gt;
&lt;br /&gt;
==== W64 ====&lt;br /&gt;
&lt;br /&gt;
Read first the INSTALL.W64 documentation note containing some specific 64bits information.&lt;br /&gt;
See also INSTALL.W32 that still provides additonnal build information common to both the 64 and 32 bit versions.&lt;br /&gt;
&lt;br /&gt;
You may be surprised: the 64bit artefacts are indeed output in the out32* sub-directories and bear names ending *32.dll. Fact is the 64 bit compile target is so far an incremental change over the legacy 32bit windows target. Numerous compile flags are still labelled &amp;quot;32&amp;quot; although those do apply to both 32 and 64bit targets.&lt;br /&gt;
&lt;br /&gt;
The important pre-requisites are to have PERL available (for essential file processing so as to prepare sources and scripts for the target OS) and of course a C compiler like Microsoft Visual Studio for C/C++.&lt;br /&gt;
&lt;br /&gt;
Using MS Visual Studio:&lt;br /&gt;
# launch a Visual Studio tool x64 Cross Tools Command prompt&lt;br /&gt;
# change to the directory where you have copied openssl sources &amp;lt;code&amp;gt;cd c:\myPath\openssl&amp;lt;/code&amp;gt;&lt;br /&gt;
# configure for the target OS with the command &amp;lt;code&amp;gt;perl Configure VC-WIN64A&amp;lt;/code&amp;gt;. You may also be interested to set more configuration options as documented in the general INSTALL note (for UNIX targets). For instance: &amp;lt;code&amp;gt;perl Configure no-asm VC-WIN64A&amp;lt;/code&amp;gt;.&lt;br /&gt;
# prepare the target environment with the command: &amp;lt;code&amp;gt;ms\do_win64a&amp;lt;/code&amp;gt;&lt;br /&gt;
# ensure you start afresh and notably without linkable products from a previous 32bit compile (as 32 and 64 bits compiling still share common directories) with the command: &amp;lt;code&amp;gt;nmake -f ms\ntdll.mak clean&amp;lt;/code&amp;gt; for the DLL target and &amp;lt;code&amp;gt;nmake -f ms\nt.mak clean&amp;lt;/code&amp;gt; for static libraries.&lt;br /&gt;
# build the code with: &amp;lt;code&amp;gt;nmake -f ms\ntdll.mak&amp;lt;/code&amp;gt; (respectively &amp;lt;code&amp;gt;nmake -f ms\nt.mak&amp;lt;/code&amp;gt; )&lt;br /&gt;
# the artefacts will be found in sub directories out32dll and out32dll.dbg (respectively out32 and out32.dbg for static libraries). The libcrypto and ssl libraries are still named libeay32.lib and ssleay32.lib, and associated includes in inc32 ! You may check this is true 64bit code using the Visual Studio tool 'dumbin'. For instance &amp;lt;code&amp;gt;dumpbin  /headers out32dll/libeay32.lib | more&amp;lt;/code&amp;gt;, and look at the FILE HEADER section.&lt;br /&gt;
# test the code using the various *test.exe programs in out32dll. Use the 'test' make target to run all tests as in &amp;lt;code&amp;gt;nmake -f ms\ntdll.mak test&amp;lt;/code&amp;gt;&lt;br /&gt;
# we recommend that you move/copy needed includes and libraries from the &amp;quot;32&amp;quot; directories under a new explicit directory tree for 64bit applications from where you will import and link your target applications, similar to that explained in INSTALL.W32.&lt;br /&gt;
&lt;br /&gt;
==== Windows CE ====&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
The earlier discussion presented a lot of information (and some of it had OS X information). Here are the TLDR versions to configure, build and install the library.&lt;br /&gt;
&lt;br /&gt;
If configuring for 64-bit OS X, then use a command similar to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./Configure darwin64-x86_64-cc enable-ec_nistp_64_gcc_128 no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macos-x86_64&lt;br /&gt;
make&lt;br /&gt;
sudo make install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If configuring for 32-bit OS X, then use a command similar to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;./Configure darwin64-i386-cc no-ssl2 no-ssl3 no-comp --openssldir=/usr/local/ssl/macosx-i386&lt;br /&gt;
make&lt;br /&gt;
sudo make install&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== iOS ===&lt;br /&gt;
&lt;br /&gt;
=== Android ===&lt;br /&gt;
&lt;br /&gt;
Visit [[Android]] and [[FIPS Library and Android]].&lt;br /&gt;
&lt;br /&gt;
=== More ===&lt;br /&gt;
&lt;br /&gt;
==== VAX/VMS ====&lt;br /&gt;
&lt;br /&gt;
I you wonder what are files ending with .com like test/testca.com those are VAX/VMX scripts.&lt;br /&gt;
This code is still maintained.&lt;br /&gt;
&lt;br /&gt;
==== OS/2 ====&lt;br /&gt;
&lt;br /&gt;
==== NetWare ====&lt;br /&gt;
5.x 6.x&lt;br /&gt;
&lt;br /&gt;
==== HP-UX ====&lt;br /&gt;
[[HP-UX Itanium FIPS and OpenSSL build]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Shell level]]&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category:Compilation]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Hostname_validation&amp;diff=2140</id>
		<title>Hostname validation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Hostname_validation&amp;diff=2140"/>
		<updated>2015-01-26T19:19:44Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Recommendation */  add code sample&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;One [https://crypto.stanford.edu/~dabo/pubs/abstracts/ssl-client-bugs.html very common mistake] made by users of OpenSSL is to assume that OpenSSL will validate the hostname in the server's certificate.  Currently, it does not, although a future version (1.1.0?) will include this functionality.&lt;br /&gt;
&lt;br /&gt;
== Recommendation ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
(extracted from mailling list discussion answer from Viktor Dukhovni who actual did implement part of host checking extensions ) &lt;br /&gt;
&lt;br /&gt;
Starting with 1.0.2 version use '''X509_check_host()''' https://www.openssl.org/docs/crypto/X509_check_host.html interface&lt;br /&gt;
&lt;br /&gt;
sample :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	const char *servername;&lt;br /&gt;
	SSL *ssl;&lt;br /&gt;
	X509_VERIFY_PARAM *param;&lt;br /&gt;
&lt;br /&gt;
	servername = &amp;quot;www.example.com&amp;quot;;&lt;br /&gt;
	ssl = SSL_new(...);&lt;br /&gt;
	param = SSL_get0_param(ssl);&lt;br /&gt;
&lt;br /&gt;
	/* Enable automatic hostname checks */&lt;br /&gt;
	X509_VERIFY_PARAM_set_hostflags(param, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);&lt;br /&gt;
	X509_VERIFY_PARAM_set1_host(param, servername, 0);&lt;br /&gt;
&lt;br /&gt;
	/* Configure a non-zero callback if desired */&lt;br /&gt;
	SSL_set_verify(ssl, SSL_VERIFY_PEER, 0);&lt;br /&gt;
&lt;br /&gt;
	/*&lt;br /&gt;
	 * Establish SSL connection, hostname should be checked&lt;br /&gt;
	 * automatically test with a hostname that should not match,&lt;br /&gt;
	 * the connection will fail (unless you specify a callback&lt;br /&gt;
	 * that returns despite the verification failure.  In that&lt;br /&gt;
	 * case SSL_get_verify_status() can expose the problem after&lt;br /&gt;
	 * connection completion.&lt;br /&gt;
	 */&lt;br /&gt;
	 ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Wildcard support is configured via the flags documented for X509_check_host(), the two most frequently useful are:&lt;br /&gt;
* '''X509_CHECK_FLAG_NO_WILDCARDS'''&lt;br /&gt;
* '''X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS'''&lt;br /&gt;
&lt;br /&gt;
populate the X509_VERIFY_PARAMS with the desired hostname, and let the OpenSSL code call X509_check_host automatically. &lt;br /&gt;
&lt;br /&gt;
This makes it easier to some day enable DANE TLSA support, because with DANE, name checks need to be skipped for DANE-EE(3) TLSA records, as the DNSSEC TLSA records provides the requisite name&lt;br /&gt;
binding instead.&lt;br /&gt;
&lt;br /&gt;
Also with the X509_VERIFY_PARAM approach, name checks happen early, and for applications that don't continue handshakes with unauthenticated peers, terminate as early as possible.&lt;br /&gt;
&lt;br /&gt;
There is an associated new X509 error code: '''X509_V_ERR_HOSTNAME_MISMATCH'''&lt;br /&gt;
&lt;br /&gt;
== cUrl code ==&lt;br /&gt;
&lt;br /&gt;
This was the original information, might still be valid for &amp;lt; 1.0.2 openssl versions :&lt;br /&gt;
&lt;br /&gt;
[https://github.com/iSECPartners/ssl-conservatory Here is some sample code] which shows how validating the hostname can be done.  However, it does not handle wildcard certificates, so [http://archives.seul.org/libevent/users/Feb-2013/msg00043.html borrowing some code from cURL] might be one way to go.&lt;br /&gt;
&lt;br /&gt;
for sake of simplicity i copied here the related code of last CURL reference :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Obtained from: https://github.com/iSECPartners/ssl-conservatory */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
Copyright (C) 2012, iSEC Partners.&lt;br /&gt;
&lt;br /&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of&lt;br /&gt;
this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal in&lt;br /&gt;
the Software without restriction, including without limitation the rights to&lt;br /&gt;
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies&lt;br /&gt;
of the Software, and to permit persons to whom the Software is furnished to do&lt;br /&gt;
so, subject to the following conditions:&lt;br /&gt;
&lt;br /&gt;
The above copyright notice and this permission notice shall be included in all&lt;br /&gt;
copies or substantial portions of the Software.&lt;br /&gt;
&lt;br /&gt;
THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&lt;br /&gt;
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&lt;br /&gt;
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&lt;br /&gt;
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&lt;br /&gt;
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&lt;br /&gt;
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&lt;br /&gt;
SOFTWARE.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * Helper functions to perform basic hostname validation using OpenSSL.&lt;br /&gt;
 *&lt;br /&gt;
 * Please read &amp;quot;everything-you-wanted-to-know-about-openssl.pdf&amp;quot; before&lt;br /&gt;
 * attempting to use this code. This whitepaper describes how the code works,&lt;br /&gt;
 * how it should be used, and what its limitations are.&lt;br /&gt;
 *&lt;br /&gt;
 * Author:  Alban Diquet&lt;br /&gt;
 * License: See LICENSE&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// Get rid of OSX 10.7 and greater deprecation warnings.&lt;br /&gt;
#if defined(__APPLE__) &amp;amp;&amp;amp; defined(__clang__)&lt;br /&gt;
#pragma clang diagnostic ignored &amp;quot;-Wdeprecated-declarations&amp;quot;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;openssl/x509v3.h&amp;gt;&lt;br /&gt;
#include &amp;lt;openssl/ssl.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;openssl_hostname_validation.h&amp;quot;&lt;br /&gt;
#include &amp;quot;hostcheck.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#define HOSTNAME_MAX_SIZE 255&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Tries to find a match for hostname in the certificate's Common Name field.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if the Common Name had a NUL character embedded in it.&lt;br /&gt;
* Returns Error if the Common Name could not be extracted.&lt;br /&gt;
*/&lt;br /&gt;
static HostnameValidationResult matches_common_name(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        int common_name_loc = -1;&lt;br /&gt;
        X509_NAME_ENTRY *common_name_entry = NULL;&lt;br /&gt;
        ASN1_STRING *common_name_asn1 = NULL;&lt;br /&gt;
        char *common_name_str = NULL;&lt;br /&gt;
&lt;br /&gt;
        // Find the position of the CN field in the Subject field of the certificate&lt;br /&gt;
        common_name_loc = X509_NAME_get_index_by_NID(X509_get_subject_name((X509 *) server_cert), NID_commonName, -1);&lt;br /&gt;
        if (common_name_loc &amp;lt; 0) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Extract the CN field&lt;br /&gt;
        common_name_entry = X509_NAME_get_entry(X509_get_subject_name((X509 *) server_cert), common_name_loc);&lt;br /&gt;
        if (common_name_entry == NULL) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Convert the CN field to a C string&lt;br /&gt;
        common_name_asn1 = X509_NAME_ENTRY_get_data(common_name_entry);&lt;br /&gt;
        if (common_name_asn1 == NULL) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
        common_name_str = (char *) ASN1_STRING_data(common_name_asn1);&lt;br /&gt;
&lt;br /&gt;
        // Make sure there isn't an embedded NUL character in the CN&lt;br /&gt;
        if ((size_t)ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) {&lt;br /&gt;
                return MalformedCertificate;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Compare expected hostname with the CN&lt;br /&gt;
        if (Curl_cert_hostcheck(common_name_str, hostname) == CURL_HOST_MATCH) {&lt;br /&gt;
                return MatchFound;&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
                return MatchNotFound;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Tries to find a match for hostname in the certificate's Subject Alternative Name extension.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.&lt;br /&gt;
* Returns NoSANPresent if the SAN extension was not present in the certificate.&lt;br /&gt;
*/&lt;br /&gt;
static HostnameValidationResult matches_subject_alternative_name(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        HostnameValidationResult result = MatchNotFound;&lt;br /&gt;
        int i;&lt;br /&gt;
        int san_names_nb = -1;&lt;br /&gt;
        STACK_OF(GENERAL_NAME) *san_names = NULL;&lt;br /&gt;
&lt;br /&gt;
        // Try to extract the names within the SAN extension from the certificate&lt;br /&gt;
        san_names = X509_get_ext_d2i((X509 *) server_cert, NID_subject_alt_name, NULL, NULL);&lt;br /&gt;
        if (san_names == NULL) {&lt;br /&gt;
                return NoSANPresent;&lt;br /&gt;
        }&lt;br /&gt;
        san_names_nb = sk_GENERAL_NAME_num(san_names);&lt;br /&gt;
&lt;br /&gt;
        // Check each name within the extension&lt;br /&gt;
        for (i=0; i&amp;lt;san_names_nb; i++) {&lt;br /&gt;
                const GENERAL_NAME *current_name = sk_GENERAL_NAME_value(san_names, i);&lt;br /&gt;
&lt;br /&gt;
                if (current_name-&amp;gt;type == GEN_DNS) {&lt;br /&gt;
                        // Current name is a DNS name, let's check it&lt;br /&gt;
                        char *dns_name = (char *) ASN1_STRING_data(current_name-&amp;gt;d.dNSName);&lt;br /&gt;
&lt;br /&gt;
                        // Make sure there isn't an embedded NUL character in the DNS name&lt;br /&gt;
                        if ((size_t)ASN1_STRING_length(current_name-&amp;gt;d.dNSName) != strlen(dns_name)) {&lt;br /&gt;
                                result = MalformedCertificate;&lt;br /&gt;
                                break;&lt;br /&gt;
                        }&lt;br /&gt;
                        else { // Compare expected hostname with the DNS name&lt;br /&gt;
                                if (Curl_cert_hostcheck(dns_name, hostname)&lt;br /&gt;
                                    == CURL_HOST_MATCH) {&lt;br /&gt;
                                        result = MatchFound;&lt;br /&gt;
                                        break;&lt;br /&gt;
                                }&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
        sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free);&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Validates the server's identity by looking for the expected hostname in the&lt;br /&gt;
* server's certificate. As described in RFC 6125, it first tries to find a match&lt;br /&gt;
* in the Subject Alternative Name extension. If the extension is not present in&lt;br /&gt;
* the certificate, it checks the Common Name instead.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.&lt;br /&gt;
* Returns Error if there was an error.&lt;br /&gt;
*/&lt;br /&gt;
HostnameValidationResult validate_hostname(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        HostnameValidationResult result;&lt;br /&gt;
&lt;br /&gt;
        if((hostname == NULL) || (server_cert == NULL))&lt;br /&gt;
                return Error;&lt;br /&gt;
&lt;br /&gt;
        // First try the Subject Alternative Names extension&lt;br /&gt;
        result = matches_subject_alternative_name(hostname, server_cert);&lt;br /&gt;
        if (result == NoSANPresent) {&lt;br /&gt;
                // Extension was not found: try the Common Name&lt;br /&gt;
                result = matches_common_name(hostname, server_cert);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:SSL/TLS]]&lt;br /&gt;
[[Category:Common Mistake]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Hostname_validation&amp;diff=2139</id>
		<title>Hostname validation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Hostname_validation&amp;diff=2139"/>
		<updated>2015-01-26T17:55:25Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* cUrl code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;One [https://crypto.stanford.edu/~dabo/pubs/abstracts/ssl-client-bugs.html very common mistake] made by users of OpenSSL is to assume that OpenSSL will validate the hostname in the server's certificate.  Currently, it does not, although a future version (1.1.0?) will include this functionality.&lt;br /&gt;
&lt;br /&gt;
== Recommendation ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
(extracted from mailling list discussion answer from Viktor Dukhovni) &lt;br /&gt;
&lt;br /&gt;
Starting with 1.0.2 version use '''X509_check_host()''' https://www.openssl.org/docs/crypto/X509_check_host.html interface&lt;br /&gt;
&lt;br /&gt;
Wildcard support is configured via the flags documented for X509_check_host(), the two most frequently useful are:&lt;br /&gt;
* '''X509_CHECK_FLAG_NO_WILDCARDS'''&lt;br /&gt;
* '''X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS'''&lt;br /&gt;
&lt;br /&gt;
populate the X509_VERIFY_PARAMS with the desired hostname, and let the OpenSSL code call X509_check_host automatically. &lt;br /&gt;
&lt;br /&gt;
This makes it easier to some day enable DANE TLSA support, because with DANE, name checks need to be skipped for DANE-EE(3) TLSA records, as the DNSSEC TLSA records provides the requisite name&lt;br /&gt;
binding instead.&lt;br /&gt;
&lt;br /&gt;
Also with the X509_VERIFY_PARAM approach, name checks happen early, and for applications that don't continue handshakes with unauthenticated peers, terminate as early as possible.&lt;br /&gt;
&lt;br /&gt;
There is an associated new X509 error code: '''X509_V_ERR_HOSTNAME_MISMATCH'''&lt;br /&gt;
&lt;br /&gt;
== cUrl code ==&lt;br /&gt;
&lt;br /&gt;
This was the original information, might still be valid for &amp;lt; 1.0.2 openssl versions :&lt;br /&gt;
&lt;br /&gt;
[https://github.com/iSECPartners/ssl-conservatory Here is some sample code] which shows how validating the hostname can be done.  However, it does not handle wildcard certificates, so [http://archives.seul.org/libevent/users/Feb-2013/msg00043.html borrowing some code from cURL] might be one way to go.&lt;br /&gt;
&lt;br /&gt;
for sake of simplicity i copied here the related code of last CURL reference :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Obtained from: https://github.com/iSECPartners/ssl-conservatory */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
Copyright (C) 2012, iSEC Partners.&lt;br /&gt;
&lt;br /&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of&lt;br /&gt;
this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal in&lt;br /&gt;
the Software without restriction, including without limitation the rights to&lt;br /&gt;
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies&lt;br /&gt;
of the Software, and to permit persons to whom the Software is furnished to do&lt;br /&gt;
so, subject to the following conditions:&lt;br /&gt;
&lt;br /&gt;
The above copyright notice and this permission notice shall be included in all&lt;br /&gt;
copies or substantial portions of the Software.&lt;br /&gt;
&lt;br /&gt;
THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&lt;br /&gt;
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&lt;br /&gt;
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&lt;br /&gt;
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&lt;br /&gt;
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&lt;br /&gt;
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&lt;br /&gt;
SOFTWARE.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * Helper functions to perform basic hostname validation using OpenSSL.&lt;br /&gt;
 *&lt;br /&gt;
 * Please read &amp;quot;everything-you-wanted-to-know-about-openssl.pdf&amp;quot; before&lt;br /&gt;
 * attempting to use this code. This whitepaper describes how the code works,&lt;br /&gt;
 * how it should be used, and what its limitations are.&lt;br /&gt;
 *&lt;br /&gt;
 * Author:  Alban Diquet&lt;br /&gt;
 * License: See LICENSE&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// Get rid of OSX 10.7 and greater deprecation warnings.&lt;br /&gt;
#if defined(__APPLE__) &amp;amp;&amp;amp; defined(__clang__)&lt;br /&gt;
#pragma clang diagnostic ignored &amp;quot;-Wdeprecated-declarations&amp;quot;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;openssl/x509v3.h&amp;gt;&lt;br /&gt;
#include &amp;lt;openssl/ssl.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;openssl_hostname_validation.h&amp;quot;&lt;br /&gt;
#include &amp;quot;hostcheck.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#define HOSTNAME_MAX_SIZE 255&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Tries to find a match for hostname in the certificate's Common Name field.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if the Common Name had a NUL character embedded in it.&lt;br /&gt;
* Returns Error if the Common Name could not be extracted.&lt;br /&gt;
*/&lt;br /&gt;
static HostnameValidationResult matches_common_name(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        int common_name_loc = -1;&lt;br /&gt;
        X509_NAME_ENTRY *common_name_entry = NULL;&lt;br /&gt;
        ASN1_STRING *common_name_asn1 = NULL;&lt;br /&gt;
        char *common_name_str = NULL;&lt;br /&gt;
&lt;br /&gt;
        // Find the position of the CN field in the Subject field of the certificate&lt;br /&gt;
        common_name_loc = X509_NAME_get_index_by_NID(X509_get_subject_name((X509 *) server_cert), NID_commonName, -1);&lt;br /&gt;
        if (common_name_loc &amp;lt; 0) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Extract the CN field&lt;br /&gt;
        common_name_entry = X509_NAME_get_entry(X509_get_subject_name((X509 *) server_cert), common_name_loc);&lt;br /&gt;
        if (common_name_entry == NULL) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Convert the CN field to a C string&lt;br /&gt;
        common_name_asn1 = X509_NAME_ENTRY_get_data(common_name_entry);&lt;br /&gt;
        if (common_name_asn1 == NULL) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
        common_name_str = (char *) ASN1_STRING_data(common_name_asn1);&lt;br /&gt;
&lt;br /&gt;
        // Make sure there isn't an embedded NUL character in the CN&lt;br /&gt;
        if ((size_t)ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) {&lt;br /&gt;
                return MalformedCertificate;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Compare expected hostname with the CN&lt;br /&gt;
        if (Curl_cert_hostcheck(common_name_str, hostname) == CURL_HOST_MATCH) {&lt;br /&gt;
                return MatchFound;&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
                return MatchNotFound;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Tries to find a match for hostname in the certificate's Subject Alternative Name extension.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.&lt;br /&gt;
* Returns NoSANPresent if the SAN extension was not present in the certificate.&lt;br /&gt;
*/&lt;br /&gt;
static HostnameValidationResult matches_subject_alternative_name(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        HostnameValidationResult result = MatchNotFound;&lt;br /&gt;
        int i;&lt;br /&gt;
        int san_names_nb = -1;&lt;br /&gt;
        STACK_OF(GENERAL_NAME) *san_names = NULL;&lt;br /&gt;
&lt;br /&gt;
        // Try to extract the names within the SAN extension from the certificate&lt;br /&gt;
        san_names = X509_get_ext_d2i((X509 *) server_cert, NID_subject_alt_name, NULL, NULL);&lt;br /&gt;
        if (san_names == NULL) {&lt;br /&gt;
                return NoSANPresent;&lt;br /&gt;
        }&lt;br /&gt;
        san_names_nb = sk_GENERAL_NAME_num(san_names);&lt;br /&gt;
&lt;br /&gt;
        // Check each name within the extension&lt;br /&gt;
        for (i=0; i&amp;lt;san_names_nb; i++) {&lt;br /&gt;
                const GENERAL_NAME *current_name = sk_GENERAL_NAME_value(san_names, i);&lt;br /&gt;
&lt;br /&gt;
                if (current_name-&amp;gt;type == GEN_DNS) {&lt;br /&gt;
                        // Current name is a DNS name, let's check it&lt;br /&gt;
                        char *dns_name = (char *) ASN1_STRING_data(current_name-&amp;gt;d.dNSName);&lt;br /&gt;
&lt;br /&gt;
                        // Make sure there isn't an embedded NUL character in the DNS name&lt;br /&gt;
                        if ((size_t)ASN1_STRING_length(current_name-&amp;gt;d.dNSName) != strlen(dns_name)) {&lt;br /&gt;
                                result = MalformedCertificate;&lt;br /&gt;
                                break;&lt;br /&gt;
                        }&lt;br /&gt;
                        else { // Compare expected hostname with the DNS name&lt;br /&gt;
                                if (Curl_cert_hostcheck(dns_name, hostname)&lt;br /&gt;
                                    == CURL_HOST_MATCH) {&lt;br /&gt;
                                        result = MatchFound;&lt;br /&gt;
                                        break;&lt;br /&gt;
                                }&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
        sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free);&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Validates the server's identity by looking for the expected hostname in the&lt;br /&gt;
* server's certificate. As described in RFC 6125, it first tries to find a match&lt;br /&gt;
* in the Subject Alternative Name extension. If the extension is not present in&lt;br /&gt;
* the certificate, it checks the Common Name instead.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.&lt;br /&gt;
* Returns Error if there was an error.&lt;br /&gt;
*/&lt;br /&gt;
HostnameValidationResult validate_hostname(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        HostnameValidationResult result;&lt;br /&gt;
&lt;br /&gt;
        if((hostname == NULL) || (server_cert == NULL))&lt;br /&gt;
                return Error;&lt;br /&gt;
&lt;br /&gt;
        // First try the Subject Alternative Names extension&lt;br /&gt;
        result = matches_subject_alternative_name(hostname, server_cert);&lt;br /&gt;
        if (result == NoSANPresent) {&lt;br /&gt;
                // Extension was not found: try the Common Name&lt;br /&gt;
                result = matches_common_name(hostname, server_cert);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:SSL/TLS]]&lt;br /&gt;
[[Category:Common Mistake]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Hostname_validation&amp;diff=2138</id>
		<title>Hostname validation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Hostname_validation&amp;diff=2138"/>
		<updated>2015-01-26T17:54:26Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Recommendation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;One [https://crypto.stanford.edu/~dabo/pubs/abstracts/ssl-client-bugs.html very common mistake] made by users of OpenSSL is to assume that OpenSSL will validate the hostname in the server's certificate.  Currently, it does not, although a future version (1.1.0?) will include this functionality.&lt;br /&gt;
&lt;br /&gt;
== Recommendation ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
(extracted from mailling list discussion answer from Viktor Dukhovni) &lt;br /&gt;
&lt;br /&gt;
Starting with 1.0.2 version use '''X509_check_host()''' https://www.openssl.org/docs/crypto/X509_check_host.html interface&lt;br /&gt;
&lt;br /&gt;
Wildcard support is configured via the flags documented for X509_check_host(), the two most frequently useful are:&lt;br /&gt;
* '''X509_CHECK_FLAG_NO_WILDCARDS'''&lt;br /&gt;
* '''X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS'''&lt;br /&gt;
&lt;br /&gt;
populate the X509_VERIFY_PARAMS with the desired hostname, and let the OpenSSL code call X509_check_host automatically. &lt;br /&gt;
&lt;br /&gt;
This makes it easier to some day enable DANE TLSA support, because with DANE, name checks need to be skipped for DANE-EE(3) TLSA records, as the DNSSEC TLSA records provides the requisite name&lt;br /&gt;
binding instead.&lt;br /&gt;
&lt;br /&gt;
Also with the X509_VERIFY_PARAM approach, name checks happen early, and for applications that don't continue handshakes with unauthenticated peers, terminate as early as possible.&lt;br /&gt;
&lt;br /&gt;
There is an associated new X509 error code: '''X509_V_ERR_HOSTNAME_MISMATCH'''&lt;br /&gt;
&lt;br /&gt;
== cUrl code ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/iSECPartners/ssl-conservatory Here is some sample code] which shows how validating the hostname can be done.  However, it does not handle wildcard certificates, so [http://archives.seul.org/libevent/users/Feb-2013/msg00043.html borrowing some code from cURL] might be one way to go.&lt;br /&gt;
&lt;br /&gt;
for sake of simplicity i copied here the related code of last CURL reference :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Obtained from: https://github.com/iSECPartners/ssl-conservatory */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
Copyright (C) 2012, iSEC Partners.&lt;br /&gt;
&lt;br /&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of&lt;br /&gt;
this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal in&lt;br /&gt;
the Software without restriction, including without limitation the rights to&lt;br /&gt;
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies&lt;br /&gt;
of the Software, and to permit persons to whom the Software is furnished to do&lt;br /&gt;
so, subject to the following conditions:&lt;br /&gt;
&lt;br /&gt;
The above copyright notice and this permission notice shall be included in all&lt;br /&gt;
copies or substantial portions of the Software.&lt;br /&gt;
&lt;br /&gt;
THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&lt;br /&gt;
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&lt;br /&gt;
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&lt;br /&gt;
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&lt;br /&gt;
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&lt;br /&gt;
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&lt;br /&gt;
SOFTWARE.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * Helper functions to perform basic hostname validation using OpenSSL.&lt;br /&gt;
 *&lt;br /&gt;
 * Please read &amp;quot;everything-you-wanted-to-know-about-openssl.pdf&amp;quot; before&lt;br /&gt;
 * attempting to use this code. This whitepaper describes how the code works,&lt;br /&gt;
 * how it should be used, and what its limitations are.&lt;br /&gt;
 *&lt;br /&gt;
 * Author:  Alban Diquet&lt;br /&gt;
 * License: See LICENSE&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// Get rid of OSX 10.7 and greater deprecation warnings.&lt;br /&gt;
#if defined(__APPLE__) &amp;amp;&amp;amp; defined(__clang__)&lt;br /&gt;
#pragma clang diagnostic ignored &amp;quot;-Wdeprecated-declarations&amp;quot;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;openssl/x509v3.h&amp;gt;&lt;br /&gt;
#include &amp;lt;openssl/ssl.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;openssl_hostname_validation.h&amp;quot;&lt;br /&gt;
#include &amp;quot;hostcheck.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#define HOSTNAME_MAX_SIZE 255&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Tries to find a match for hostname in the certificate's Common Name field.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if the Common Name had a NUL character embedded in it.&lt;br /&gt;
* Returns Error if the Common Name could not be extracted.&lt;br /&gt;
*/&lt;br /&gt;
static HostnameValidationResult matches_common_name(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        int common_name_loc = -1;&lt;br /&gt;
        X509_NAME_ENTRY *common_name_entry = NULL;&lt;br /&gt;
        ASN1_STRING *common_name_asn1 = NULL;&lt;br /&gt;
        char *common_name_str = NULL;&lt;br /&gt;
&lt;br /&gt;
        // Find the position of the CN field in the Subject field of the certificate&lt;br /&gt;
        common_name_loc = X509_NAME_get_index_by_NID(X509_get_subject_name((X509 *) server_cert), NID_commonName, -1);&lt;br /&gt;
        if (common_name_loc &amp;lt; 0) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Extract the CN field&lt;br /&gt;
        common_name_entry = X509_NAME_get_entry(X509_get_subject_name((X509 *) server_cert), common_name_loc);&lt;br /&gt;
        if (common_name_entry == NULL) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Convert the CN field to a C string&lt;br /&gt;
        common_name_asn1 = X509_NAME_ENTRY_get_data(common_name_entry);&lt;br /&gt;
        if (common_name_asn1 == NULL) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
        common_name_str = (char *) ASN1_STRING_data(common_name_asn1);&lt;br /&gt;
&lt;br /&gt;
        // Make sure there isn't an embedded NUL character in the CN&lt;br /&gt;
        if ((size_t)ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) {&lt;br /&gt;
                return MalformedCertificate;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Compare expected hostname with the CN&lt;br /&gt;
        if (Curl_cert_hostcheck(common_name_str, hostname) == CURL_HOST_MATCH) {&lt;br /&gt;
                return MatchFound;&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
                return MatchNotFound;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Tries to find a match for hostname in the certificate's Subject Alternative Name extension.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.&lt;br /&gt;
* Returns NoSANPresent if the SAN extension was not present in the certificate.&lt;br /&gt;
*/&lt;br /&gt;
static HostnameValidationResult matches_subject_alternative_name(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        HostnameValidationResult result = MatchNotFound;&lt;br /&gt;
        int i;&lt;br /&gt;
        int san_names_nb = -1;&lt;br /&gt;
        STACK_OF(GENERAL_NAME) *san_names = NULL;&lt;br /&gt;
&lt;br /&gt;
        // Try to extract the names within the SAN extension from the certificate&lt;br /&gt;
        san_names = X509_get_ext_d2i((X509 *) server_cert, NID_subject_alt_name, NULL, NULL);&lt;br /&gt;
        if (san_names == NULL) {&lt;br /&gt;
                return NoSANPresent;&lt;br /&gt;
        }&lt;br /&gt;
        san_names_nb = sk_GENERAL_NAME_num(san_names);&lt;br /&gt;
&lt;br /&gt;
        // Check each name within the extension&lt;br /&gt;
        for (i=0; i&amp;lt;san_names_nb; i++) {&lt;br /&gt;
                const GENERAL_NAME *current_name = sk_GENERAL_NAME_value(san_names, i);&lt;br /&gt;
&lt;br /&gt;
                if (current_name-&amp;gt;type == GEN_DNS) {&lt;br /&gt;
                        // Current name is a DNS name, let's check it&lt;br /&gt;
                        char *dns_name = (char *) ASN1_STRING_data(current_name-&amp;gt;d.dNSName);&lt;br /&gt;
&lt;br /&gt;
                        // Make sure there isn't an embedded NUL character in the DNS name&lt;br /&gt;
                        if ((size_t)ASN1_STRING_length(current_name-&amp;gt;d.dNSName) != strlen(dns_name)) {&lt;br /&gt;
                                result = MalformedCertificate;&lt;br /&gt;
                                break;&lt;br /&gt;
                        }&lt;br /&gt;
                        else { // Compare expected hostname with the DNS name&lt;br /&gt;
                                if (Curl_cert_hostcheck(dns_name, hostname)&lt;br /&gt;
                                    == CURL_HOST_MATCH) {&lt;br /&gt;
                                        result = MatchFound;&lt;br /&gt;
                                        break;&lt;br /&gt;
                                }&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
        sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free);&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Validates the server's identity by looking for the expected hostname in the&lt;br /&gt;
* server's certificate. As described in RFC 6125, it first tries to find a match&lt;br /&gt;
* in the Subject Alternative Name extension. If the extension is not present in&lt;br /&gt;
* the certificate, it checks the Common Name instead.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.&lt;br /&gt;
* Returns Error if there was an error.&lt;br /&gt;
*/&lt;br /&gt;
HostnameValidationResult validate_hostname(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        HostnameValidationResult result;&lt;br /&gt;
&lt;br /&gt;
        if((hostname == NULL) || (server_cert == NULL))&lt;br /&gt;
                return Error;&lt;br /&gt;
&lt;br /&gt;
        // First try the Subject Alternative Names extension&lt;br /&gt;
        result = matches_subject_alternative_name(hostname, server_cert);&lt;br /&gt;
        if (result == NoSANPresent) {&lt;br /&gt;
                // Extension was not found: try the Common Name&lt;br /&gt;
                result = matches_common_name(hostname, server_cert);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:SSL/TLS]]&lt;br /&gt;
[[Category:Common Mistake]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Hostname_validation&amp;diff=2137</id>
		<title>Hostname validation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Hostname_validation&amp;diff=2137"/>
		<updated>2015-01-26T17:53:41Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: updated content according to mailling list discussions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;One [https://crypto.stanford.edu/~dabo/pubs/abstracts/ssl-client-bugs.html very common mistake] made by users of OpenSSL is to assume that OpenSSL will validate the hostname in the server's certificate.  Currently, it does not, although a future version (1.1.0?) will include this functionality.&lt;br /&gt;
&lt;br /&gt;
== Recommendation ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
(extracted from mailling list discussion answer from Viktor Dukhovni) &lt;br /&gt;
&lt;br /&gt;
Starting with 1.0.2 version use '''X509_check_host()''' [[X509_check_host]] interface&lt;br /&gt;
&lt;br /&gt;
Wildcard support is configured via the flags documented for X509_check_host(), the two most frequently useful are:&lt;br /&gt;
* '''X509_CHECK_FLAG_NO_WILDCARDS'''&lt;br /&gt;
* '''X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS'''&lt;br /&gt;
&lt;br /&gt;
populate the X509_VERIFY_PARAMS with the desired hostname, and let the OpenSSL code call X509_check_host automatically. &lt;br /&gt;
&lt;br /&gt;
This makes it easier to some day enable DANE TLSA support, because with DANE, name checks need to be skipped for DANE-EE(3) TLSA records, as the DNSSEC TLSA records provides the requisite name&lt;br /&gt;
binding instead.&lt;br /&gt;
&lt;br /&gt;
Also with the X509_VERIFY_PARAM approach, name checks happen early, and for applications that don't continue handshakes with unauthenticated peers, terminate as early as possible.&lt;br /&gt;
&lt;br /&gt;
There is an associated new X509 error code: '''X509_V_ERR_HOSTNAME_MISMATCH'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== cUrl code ==&lt;br /&gt;
&lt;br /&gt;
[https://github.com/iSECPartners/ssl-conservatory Here is some sample code] which shows how validating the hostname can be done.  However, it does not handle wildcard certificates, so [http://archives.seul.org/libevent/users/Feb-2013/msg00043.html borrowing some code from cURL] might be one way to go.&lt;br /&gt;
&lt;br /&gt;
for sake of simplicity i copied here the related code of last CURL reference :&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/* Obtained from: https://github.com/iSECPartners/ssl-conservatory */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
Copyright (C) 2012, iSEC Partners.&lt;br /&gt;
&lt;br /&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of&lt;br /&gt;
this software and associated documentation files (the &amp;quot;Software&amp;quot;), to deal in&lt;br /&gt;
the Software without restriction, including without limitation the rights to&lt;br /&gt;
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies&lt;br /&gt;
of the Software, and to permit persons to whom the Software is furnished to do&lt;br /&gt;
so, subject to the following conditions:&lt;br /&gt;
&lt;br /&gt;
The above copyright notice and this permission notice shall be included in all&lt;br /&gt;
copies or substantial portions of the Software.&lt;br /&gt;
&lt;br /&gt;
THE SOFTWARE IS PROVIDED &amp;quot;AS IS&amp;quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR&lt;br /&gt;
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,&lt;br /&gt;
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE&lt;br /&gt;
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER&lt;br /&gt;
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,&lt;br /&gt;
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE&lt;br /&gt;
SOFTWARE.&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * Helper functions to perform basic hostname validation using OpenSSL.&lt;br /&gt;
 *&lt;br /&gt;
 * Please read &amp;quot;everything-you-wanted-to-know-about-openssl.pdf&amp;quot; before&lt;br /&gt;
 * attempting to use this code. This whitepaper describes how the code works,&lt;br /&gt;
 * how it should be used, and what its limitations are.&lt;br /&gt;
 *&lt;br /&gt;
 * Author:  Alban Diquet&lt;br /&gt;
 * License: See LICENSE&lt;br /&gt;
 *&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
// Get rid of OSX 10.7 and greater deprecation warnings.&lt;br /&gt;
#if defined(__APPLE__) &amp;amp;&amp;amp; defined(__clang__)&lt;br /&gt;
#pragma clang diagnostic ignored &amp;quot;-Wdeprecated-declarations&amp;quot;&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;openssl/x509v3.h&amp;gt;&lt;br /&gt;
#include &amp;lt;openssl/ssl.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;openssl_hostname_validation.h&amp;quot;&lt;br /&gt;
#include &amp;quot;hostcheck.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
#define HOSTNAME_MAX_SIZE 255&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Tries to find a match for hostname in the certificate's Common Name field.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if the Common Name had a NUL character embedded in it.&lt;br /&gt;
* Returns Error if the Common Name could not be extracted.&lt;br /&gt;
*/&lt;br /&gt;
static HostnameValidationResult matches_common_name(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        int common_name_loc = -1;&lt;br /&gt;
        X509_NAME_ENTRY *common_name_entry = NULL;&lt;br /&gt;
        ASN1_STRING *common_name_asn1 = NULL;&lt;br /&gt;
        char *common_name_str = NULL;&lt;br /&gt;
&lt;br /&gt;
        // Find the position of the CN field in the Subject field of the certificate&lt;br /&gt;
        common_name_loc = X509_NAME_get_index_by_NID(X509_get_subject_name((X509 *) server_cert), NID_commonName, -1);&lt;br /&gt;
        if (common_name_loc &amp;lt; 0) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Extract the CN field&lt;br /&gt;
        common_name_entry = X509_NAME_get_entry(X509_get_subject_name((X509 *) server_cert), common_name_loc);&lt;br /&gt;
        if (common_name_entry == NULL) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Convert the CN field to a C string&lt;br /&gt;
        common_name_asn1 = X509_NAME_ENTRY_get_data(common_name_entry);&lt;br /&gt;
        if (common_name_asn1 == NULL) {&lt;br /&gt;
                return Error;&lt;br /&gt;
        }&lt;br /&gt;
        common_name_str = (char *) ASN1_STRING_data(common_name_asn1);&lt;br /&gt;
&lt;br /&gt;
        // Make sure there isn't an embedded NUL character in the CN&lt;br /&gt;
        if ((size_t)ASN1_STRING_length(common_name_asn1) != strlen(common_name_str)) {&lt;br /&gt;
                return MalformedCertificate;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Compare expected hostname with the CN&lt;br /&gt;
        if (Curl_cert_hostcheck(common_name_str, hostname) == CURL_HOST_MATCH) {&lt;br /&gt;
                return MatchFound;&lt;br /&gt;
        }&lt;br /&gt;
        else {&lt;br /&gt;
                return MatchNotFound;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Tries to find a match for hostname in the certificate's Subject Alternative Name extension.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.&lt;br /&gt;
* Returns NoSANPresent if the SAN extension was not present in the certificate.&lt;br /&gt;
*/&lt;br /&gt;
static HostnameValidationResult matches_subject_alternative_name(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        HostnameValidationResult result = MatchNotFound;&lt;br /&gt;
        int i;&lt;br /&gt;
        int san_names_nb = -1;&lt;br /&gt;
        STACK_OF(GENERAL_NAME) *san_names = NULL;&lt;br /&gt;
&lt;br /&gt;
        // Try to extract the names within the SAN extension from the certificate&lt;br /&gt;
        san_names = X509_get_ext_d2i((X509 *) server_cert, NID_subject_alt_name, NULL, NULL);&lt;br /&gt;
        if (san_names == NULL) {&lt;br /&gt;
                return NoSANPresent;&lt;br /&gt;
        }&lt;br /&gt;
        san_names_nb = sk_GENERAL_NAME_num(san_names);&lt;br /&gt;
&lt;br /&gt;
        // Check each name within the extension&lt;br /&gt;
        for (i=0; i&amp;lt;san_names_nb; i++) {&lt;br /&gt;
                const GENERAL_NAME *current_name = sk_GENERAL_NAME_value(san_names, i);&lt;br /&gt;
&lt;br /&gt;
                if (current_name-&amp;gt;type == GEN_DNS) {&lt;br /&gt;
                        // Current name is a DNS name, let's check it&lt;br /&gt;
                        char *dns_name = (char *) ASN1_STRING_data(current_name-&amp;gt;d.dNSName);&lt;br /&gt;
&lt;br /&gt;
                        // Make sure there isn't an embedded NUL character in the DNS name&lt;br /&gt;
                        if ((size_t)ASN1_STRING_length(current_name-&amp;gt;d.dNSName) != strlen(dns_name)) {&lt;br /&gt;
                                result = MalformedCertificate;&lt;br /&gt;
                                break;&lt;br /&gt;
                        }&lt;br /&gt;
                        else { // Compare expected hostname with the DNS name&lt;br /&gt;
                                if (Curl_cert_hostcheck(dns_name, hostname)&lt;br /&gt;
                                    == CURL_HOST_MATCH) {&lt;br /&gt;
                                        result = MatchFound;&lt;br /&gt;
                                        break;&lt;br /&gt;
                                }&lt;br /&gt;
                        }&lt;br /&gt;
                }&lt;br /&gt;
        }&lt;br /&gt;
        sk_GENERAL_NAME_pop_free(san_names, GENERAL_NAME_free);&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
* Validates the server's identity by looking for the expected hostname in the&lt;br /&gt;
* server's certificate. As described in RFC 6125, it first tries to find a match&lt;br /&gt;
* in the Subject Alternative Name extension. If the extension is not present in&lt;br /&gt;
* the certificate, it checks the Common Name instead.&lt;br /&gt;
*&lt;br /&gt;
* Returns MatchFound if a match was found.&lt;br /&gt;
* Returns MatchNotFound if no matches were found.&lt;br /&gt;
* Returns MalformedCertificate if any of the hostnames had a NUL character embedded in it.&lt;br /&gt;
* Returns Error if there was an error.&lt;br /&gt;
*/&lt;br /&gt;
HostnameValidationResult validate_hostname(const char *hostname, const X509 *server_cert) {&lt;br /&gt;
        HostnameValidationResult result;&lt;br /&gt;
&lt;br /&gt;
        if((hostname == NULL) || (server_cert == NULL))&lt;br /&gt;
                return Error;&lt;br /&gt;
&lt;br /&gt;
        // First try the Subject Alternative Names extension&lt;br /&gt;
        result = matches_subject_alternative_name(hostname, server_cert);&lt;br /&gt;
        if (result == NoSANPresent) {&lt;br /&gt;
                // Extension was not found: try the Common Name&lt;br /&gt;
                result = matches_common_name(hostname, server_cert);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:SSL/TLS]]&lt;br /&gt;
[[Category:Common Mistake]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2035</id>
		<title>Related Links</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2035"/>
		<updated>2014-11-09T10:39:52Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Languages libraries/Wrappers relying on openssl */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please feel free to edit this page and add your own OpenSSL-based project or product. This is the one place where otherwise extraneous mention of commercial products is appropriate. Note such mention does not constitute endorsement per our [[Commercial Product Disclaimer]].&lt;br /&gt;
&lt;br /&gt;
== Open Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source license, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/amissl/ AmiSSL] || an OpenSSL port to AmigaOS&lt;br /&gt;
|-&lt;br /&gt;
| [http://botan.randombit.net/ Botan] || a C++ cryptography library which includes a TLS implementation&lt;br /&gt;
|-&lt;br /&gt;
| [https://boringssl.googlesource.com/boringssl/ BoringSSL] || a Google fork of OpenSSL ([https://www.imperialviolet.org/2014/06/20/boringssl.html Announcement ])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.bouncycastle.org/ Bouncy Castle] || cryptography API for Java and C# ([[Wikipedia: Bouncy Castle (cryptography)]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cs.auckland.ac.nz/~pgut001/cryptlib/ Cryptlib] || a security toolkit that allows one to easily add encryption and authentication services to software&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cryptopp.com/ Crypto++] || a free C++ class library of cryptographic schemes&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.gnutls.org/ GnuTLS] || an LGPL-licensed TLS library with substantial documentation&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.libressl.org/ LibreSSL] || an OpenBSD fork of OpenSSL (Press coverage: [http://www.zdnet.com/openbsd-forks-prunes-fixes-openssl-7000028613/ ZDNet], [http://arstechnica.com/information-technology/2014/04/openssl-code-beyond-repair-claims-creator-of-libressl-fork/ Ars Technica])&lt;br /&gt;
|-&lt;br /&gt;
| [http://libtom.org/ LibTomCrypt] || public domain open source crypto library written in C&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mitls.org/wsgi miTLS] || a verified reference implementation of the TLS protocol. ([http://www.reddit.com/r/netsec/comments/1zn2d3/mitls_a_verified_reference_tls_implementation/ &amp;quot;reddit: miTLS - A verified reference TLS implementation&amp;quot;])&lt;br /&gt;
|-&lt;br /&gt;
| [http://nacl.cr.yp.to/ NaCl] || NaCl (pronounced &amp;quot;salt&amp;quot;) is a easy-to-use high-speed software library for network communication, encryption, decryption, and signatures&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mozilla.org/projects/security/pki/nss/ NSS] || a set of libraries designed to support cross-platform development of security-enabled client and server applications&lt;br /&gt;
|-&lt;br /&gt;
| [http://polarssl.org/ PolarSSL] || an SSL library that handles the complexities of the Secure Sockets Layer (SSL) protocol for an application ([[Wikipedia: PolarSSL]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.ohloh.net/projects/xyssl XySSL] || a C library providing a very small footprint crypto library and SSL implementation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Open Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source License, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://libevent.org/ libevent] || an event driven library which can [http://www.wangafu.net/~nickm/libevent-book/Ref6a_advanced_bufferevents.html#_bufferevents_and_ssl optionally use OpenSSL]&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Mod_ssl mod_ssl] || SSL/TLS module for the [http://en.wikipedia.org/wiki/Apache_HTTP_Server Apache HTTP Server]&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.stunnel.org/index.html Stunnel] || an SSL encryption wrapper between remote client and local (inetd-startable) or remote server&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Languages libraries/Wrappers relying on openssl ===&lt;br /&gt;
&lt;br /&gt;
* '''libcurl''' http://curl.haxx.se/ which can use openssl&lt;br /&gt;
* '''PHP''' uses libcurl http://php.net/manual/en/intro.curl.php &lt;br /&gt;
* '''Python''' pyOpenSSL https://github.com/pyca/pyopenssl cryptography https://github.com/pyca/cryptography&lt;br /&gt;
* '''Perl''' Perl-Openssl http://sourceforge.net/projects/perl-openssl/&lt;br /&gt;
&lt;br /&gt;
== Closed Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Closed Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| Stonesoft Firewall Appliances [https://www.stonesoft.com/en/customer_care/documentation/appliances/] &lt;br /&gt;
| Stonesoft (now McAfee) Appliances uses openssl as SSL/TLS communication library, license advertised [http://www.stonesoft.com/en/customer_care/support/third_party_licenses.html]&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Even if this section is empty now, it exist a numerous number of closed source products using OpenSSL.&lt;br /&gt;
&lt;br /&gt;
== Books and Documentation == &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Books and Documentation&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Title&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations Comparison of TLS implementations]  || Wikipedia article comparing various TLS libraries&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.keylength.com/ keylength.com]  || site which summarizes various key length recommendations&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.feistyduck.com/books/openssl-cookbook/ OpenSSL Cookbook]  || A free ebook that covers configuration and command-line usage (first&lt;br /&gt;
published in 2013; continuously updated)&lt;br /&gt;
|-&lt;br /&gt;
| [http://shop.oreilly.com/product/9780596002701.do Network Security with OpenSSL]  || O'Reilly book from 2002&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2034</id>
		<title>Related Links</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2034"/>
		<updated>2014-11-09T10:22:24Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Closed Source Products Using OpenSSL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please feel free to edit this page and add your own OpenSSL-based project or product. This is the one place where otherwise extraneous mention of commercial products is appropriate. Note such mention does not constitute endorsement per our [[Commercial Product Disclaimer]].&lt;br /&gt;
&lt;br /&gt;
== Open Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source license, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/amissl/ AmiSSL] || an OpenSSL port to AmigaOS&lt;br /&gt;
|-&lt;br /&gt;
| [http://botan.randombit.net/ Botan] || a C++ cryptography library which includes a TLS implementation&lt;br /&gt;
|-&lt;br /&gt;
| [https://boringssl.googlesource.com/boringssl/ BoringSSL] || a Google fork of OpenSSL ([https://www.imperialviolet.org/2014/06/20/boringssl.html Announcement ])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.bouncycastle.org/ Bouncy Castle] || cryptography API for Java and C# ([[Wikipedia: Bouncy Castle (cryptography)]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cs.auckland.ac.nz/~pgut001/cryptlib/ Cryptlib] || a security toolkit that allows one to easily add encryption and authentication services to software&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cryptopp.com/ Crypto++] || a free C++ class library of cryptographic schemes&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.gnutls.org/ GnuTLS] || an LGPL-licensed TLS library with substantial documentation&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.libressl.org/ LibreSSL] || an OpenBSD fork of OpenSSL (Press coverage: [http://www.zdnet.com/openbsd-forks-prunes-fixes-openssl-7000028613/ ZDNet], [http://arstechnica.com/information-technology/2014/04/openssl-code-beyond-repair-claims-creator-of-libressl-fork/ Ars Technica])&lt;br /&gt;
|-&lt;br /&gt;
| [http://libtom.org/ LibTomCrypt] || public domain open source crypto library written in C&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mitls.org/wsgi miTLS] || a verified reference implementation of the TLS protocol. ([http://www.reddit.com/r/netsec/comments/1zn2d3/mitls_a_verified_reference_tls_implementation/ &amp;quot;reddit: miTLS - A verified reference TLS implementation&amp;quot;])&lt;br /&gt;
|-&lt;br /&gt;
| [http://nacl.cr.yp.to/ NaCl] || NaCl (pronounced &amp;quot;salt&amp;quot;) is a easy-to-use high-speed software library for network communication, encryption, decryption, and signatures&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mozilla.org/projects/security/pki/nss/ NSS] || a set of libraries designed to support cross-platform development of security-enabled client and server applications&lt;br /&gt;
|-&lt;br /&gt;
| [http://polarssl.org/ PolarSSL] || an SSL library that handles the complexities of the Secure Sockets Layer (SSL) protocol for an application ([[Wikipedia: PolarSSL]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.ohloh.net/projects/xyssl XySSL] || a C library providing a very small footprint crypto library and SSL implementation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Open Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source License, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://libevent.org/ libevent] || an event driven library which can [http://www.wangafu.net/~nickm/libevent-book/Ref6a_advanced_bufferevents.html#_bufferevents_and_ssl optionally use OpenSSL]&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Mod_ssl mod_ssl] || SSL/TLS module for the [http://en.wikipedia.org/wiki/Apache_HTTP_Server Apache HTTP Server]&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.stunnel.org/index.html Stunnel] || an SSL encryption wrapper between remote client and local (inetd-startable) or remote server&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Languages libraries/Wrappers relying on openssl ===&lt;br /&gt;
&lt;br /&gt;
* '''libcurl''' http://curl.haxx.se/ which can use openssl&lt;br /&gt;
* '''PHP''' uses libcurl http://php.net/manual/en/intro.curl.php &lt;br /&gt;
* '''Python''' pyOpenSSL https://github.com/pyca/pyopenssl&lt;br /&gt;
* '''Perl''' Perl-Openssl http://sourceforge.net/projects/perl-openssl/&lt;br /&gt;
&lt;br /&gt;
== Closed Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Closed Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| Stonesoft Firewall Appliances [https://www.stonesoft.com/en/customer_care/documentation/appliances/] &lt;br /&gt;
| Stonesoft (now McAfee) Appliances uses openssl as SSL/TLS communication library, license advertised [http://www.stonesoft.com/en/customer_care/support/third_party_licenses.html]&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Even if this section is empty now, it exist a numerous number of closed source products using OpenSSL.&lt;br /&gt;
&lt;br /&gt;
== Books and Documentation == &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Books and Documentation&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Title&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations Comparison of TLS implementations]  || Wikipedia article comparing various TLS libraries&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.keylength.com/ keylength.com]  || site which summarizes various key length recommendations&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.feistyduck.com/books/openssl-cookbook/ OpenSSL Cookbook]  || A free ebook that covers configuration and command-line usage (first&lt;br /&gt;
published in 2013; continuously updated)&lt;br /&gt;
|-&lt;br /&gt;
| [http://shop.oreilly.com/product/9780596002701.do Network Security with OpenSSL]  || O'Reilly book from 2002&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2033</id>
		<title>Related Links</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2033"/>
		<updated>2014-11-09T10:19:48Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Closed Source Products Using OpenSSL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please feel free to edit this page and add your own OpenSSL-based project or product. This is the one place where otherwise extraneous mention of commercial products is appropriate. Note such mention does not constitute endorsement per our [[Commercial Product Disclaimer]].&lt;br /&gt;
&lt;br /&gt;
== Open Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source license, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/amissl/ AmiSSL] || an OpenSSL port to AmigaOS&lt;br /&gt;
|-&lt;br /&gt;
| [http://botan.randombit.net/ Botan] || a C++ cryptography library which includes a TLS implementation&lt;br /&gt;
|-&lt;br /&gt;
| [https://boringssl.googlesource.com/boringssl/ BoringSSL] || a Google fork of OpenSSL ([https://www.imperialviolet.org/2014/06/20/boringssl.html Announcement ])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.bouncycastle.org/ Bouncy Castle] || cryptography API for Java and C# ([[Wikipedia: Bouncy Castle (cryptography)]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cs.auckland.ac.nz/~pgut001/cryptlib/ Cryptlib] || a security toolkit that allows one to easily add encryption and authentication services to software&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cryptopp.com/ Crypto++] || a free C++ class library of cryptographic schemes&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.gnutls.org/ GnuTLS] || an LGPL-licensed TLS library with substantial documentation&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.libressl.org/ LibreSSL] || an OpenBSD fork of OpenSSL (Press coverage: [http://www.zdnet.com/openbsd-forks-prunes-fixes-openssl-7000028613/ ZDNet], [http://arstechnica.com/information-technology/2014/04/openssl-code-beyond-repair-claims-creator-of-libressl-fork/ Ars Technica])&lt;br /&gt;
|-&lt;br /&gt;
| [http://libtom.org/ LibTomCrypt] || public domain open source crypto library written in C&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mitls.org/wsgi miTLS] || a verified reference implementation of the TLS protocol. ([http://www.reddit.com/r/netsec/comments/1zn2d3/mitls_a_verified_reference_tls_implementation/ &amp;quot;reddit: miTLS - A verified reference TLS implementation&amp;quot;])&lt;br /&gt;
|-&lt;br /&gt;
| [http://nacl.cr.yp.to/ NaCl] || NaCl (pronounced &amp;quot;salt&amp;quot;) is a easy-to-use high-speed software library for network communication, encryption, decryption, and signatures&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mozilla.org/projects/security/pki/nss/ NSS] || a set of libraries designed to support cross-platform development of security-enabled client and server applications&lt;br /&gt;
|-&lt;br /&gt;
| [http://polarssl.org/ PolarSSL] || an SSL library that handles the complexities of the Secure Sockets Layer (SSL) protocol for an application ([[Wikipedia: PolarSSL]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.ohloh.net/projects/xyssl XySSL] || a C library providing a very small footprint crypto library and SSL implementation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Open Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source License, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://libevent.org/ libevent] || an event driven library which can [http://www.wangafu.net/~nickm/libevent-book/Ref6a_advanced_bufferevents.html#_bufferevents_and_ssl optionally use OpenSSL]&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Mod_ssl mod_ssl] || SSL/TLS module for the [http://en.wikipedia.org/wiki/Apache_HTTP_Server Apache HTTP Server]&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.stunnel.org/index.html Stunnel] || an SSL encryption wrapper between remote client and local (inetd-startable) or remote server&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Languages libraries/Wrappers relying on openssl ===&lt;br /&gt;
&lt;br /&gt;
* '''libcurl''' http://curl.haxx.se/ which can use openssl&lt;br /&gt;
* '''PHP''' uses libcurl http://php.net/manual/en/intro.curl.php &lt;br /&gt;
* '''Python''' pyOpenSSL https://github.com/pyca/pyopenssl&lt;br /&gt;
* '''Perl''' Perl-Openssl http://sourceforge.net/projects/perl-openssl/&lt;br /&gt;
&lt;br /&gt;
== Closed Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Closed Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| Stonesoft Firewall Appliances [https://www.stonesoft.com/en/customer_care/documentation/appliances/] LICENSES http://www.stonesoft.com/en/customer_care/support/third_party_licenses.html&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Even if this section is empty now, it exist a numerous number of closed source products using OpenSSL.&lt;br /&gt;
&lt;br /&gt;
== Books and Documentation == &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Books and Documentation&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Title&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations Comparison of TLS implementations]  || Wikipedia article comparing various TLS libraries&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.keylength.com/ keylength.com]  || site which summarizes various key length recommendations&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.feistyduck.com/books/openssl-cookbook/ OpenSSL Cookbook]  || A free ebook that covers configuration and command-line usage (first&lt;br /&gt;
published in 2013; continuously updated)&lt;br /&gt;
|-&lt;br /&gt;
| [http://shop.oreilly.com/product/9780596002701.do Network Security with OpenSSL]  || O'Reilly book from 2002&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2032</id>
		<title>Related Links</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2032"/>
		<updated>2014-11-09T10:11:20Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Open Source Products Using OpenSSL */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please feel free to edit this page and add your own OpenSSL-based project or product. This is the one place where otherwise extraneous mention of commercial products is appropriate. Note such mention does not constitute endorsement per our [[Commercial Product Disclaimer]].&lt;br /&gt;
&lt;br /&gt;
== Open Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source license, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/amissl/ AmiSSL] || an OpenSSL port to AmigaOS&lt;br /&gt;
|-&lt;br /&gt;
| [http://botan.randombit.net/ Botan] || a C++ cryptography library which includes a TLS implementation&lt;br /&gt;
|-&lt;br /&gt;
| [https://boringssl.googlesource.com/boringssl/ BoringSSL] || a Google fork of OpenSSL ([https://www.imperialviolet.org/2014/06/20/boringssl.html Announcement ])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.bouncycastle.org/ Bouncy Castle] || cryptography API for Java and C# ([[Wikipedia: Bouncy Castle (cryptography)]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cs.auckland.ac.nz/~pgut001/cryptlib/ Cryptlib] || a security toolkit that allows one to easily add encryption and authentication services to software&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cryptopp.com/ Crypto++] || a free C++ class library of cryptographic schemes&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.gnutls.org/ GnuTLS] || an LGPL-licensed TLS library with substantial documentation&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.libressl.org/ LibreSSL] || an OpenBSD fork of OpenSSL (Press coverage: [http://www.zdnet.com/openbsd-forks-prunes-fixes-openssl-7000028613/ ZDNet], [http://arstechnica.com/information-technology/2014/04/openssl-code-beyond-repair-claims-creator-of-libressl-fork/ Ars Technica])&lt;br /&gt;
|-&lt;br /&gt;
| [http://libtom.org/ LibTomCrypt] || public domain open source crypto library written in C&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mitls.org/wsgi miTLS] || a verified reference implementation of the TLS protocol. ([http://www.reddit.com/r/netsec/comments/1zn2d3/mitls_a_verified_reference_tls_implementation/ &amp;quot;reddit: miTLS - A verified reference TLS implementation&amp;quot;])&lt;br /&gt;
|-&lt;br /&gt;
| [http://nacl.cr.yp.to/ NaCl] || NaCl (pronounced &amp;quot;salt&amp;quot;) is a easy-to-use high-speed software library for network communication, encryption, decryption, and signatures&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mozilla.org/projects/security/pki/nss/ NSS] || a set of libraries designed to support cross-platform development of security-enabled client and server applications&lt;br /&gt;
|-&lt;br /&gt;
| [http://polarssl.org/ PolarSSL] || an SSL library that handles the complexities of the Secure Sockets Layer (SSL) protocol for an application ([[Wikipedia: PolarSSL]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.ohloh.net/projects/xyssl XySSL] || a C library providing a very small footprint crypto library and SSL implementation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Open Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source License, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://libevent.org/ libevent] || an event driven library which can [http://www.wangafu.net/~nickm/libevent-book/Ref6a_advanced_bufferevents.html#_bufferevents_and_ssl optionally use OpenSSL]&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Mod_ssl mod_ssl] || SSL/TLS module for the [http://en.wikipedia.org/wiki/Apache_HTTP_Server Apache HTTP Server]&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.stunnel.org/index.html Stunnel] || an SSL encryption wrapper between remote client and local (inetd-startable) or remote server&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Languages libraries/Wrappers relying on openssl ===&lt;br /&gt;
&lt;br /&gt;
* '''libcurl''' http://curl.haxx.se/ which can use openssl&lt;br /&gt;
* '''PHP''' uses libcurl http://php.net/manual/en/intro.curl.php &lt;br /&gt;
* '''Python''' pyOpenSSL https://github.com/pyca/pyopenssl&lt;br /&gt;
* '''Perl''' Perl-Openssl http://sourceforge.net/projects/perl-openssl/&lt;br /&gt;
&lt;br /&gt;
== Closed Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Closed Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Even if this section is empty now, it exist a numerous number of closed source products using OpenSSL.&lt;br /&gt;
&lt;br /&gt;
== Books and Documentation == &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Books and Documentation&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Title&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations Comparison of TLS implementations]  || Wikipedia article comparing various TLS libraries&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.keylength.com/ keylength.com]  || site which summarizes various key length recommendations&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.feistyduck.com/books/openssl-cookbook/ OpenSSL Cookbook]  || A free ebook that covers configuration and command-line usage (first&lt;br /&gt;
published in 2013; continuously updated)&lt;br /&gt;
|-&lt;br /&gt;
| [http://shop.oreilly.com/product/9780596002701.do Network Security with OpenSSL]  || O'Reilly book from 2002&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2031</id>
		<title>Related Links</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2031"/>
		<updated>2014-11-09T10:10:13Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Languages, Programs or libraries/Wrappers relying on openssl */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please feel free to edit this page and add your own OpenSSL-based project or product. This is the one place where otherwise extraneous mention of commercial products is appropriate. Note such mention does not constitute endorsement per our [[Commercial Product Disclaimer]].&lt;br /&gt;
&lt;br /&gt;
== Open Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source license, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/amissl/ AmiSSL] || an OpenSSL port to AmigaOS&lt;br /&gt;
|-&lt;br /&gt;
| [http://botan.randombit.net/ Botan] || a C++ cryptography library which includes a TLS implementation&lt;br /&gt;
|-&lt;br /&gt;
| [https://boringssl.googlesource.com/boringssl/ BoringSSL] || a Google fork of OpenSSL ([https://www.imperialviolet.org/2014/06/20/boringssl.html Announcement ])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.bouncycastle.org/ Bouncy Castle] || cryptography API for Java and C# ([[Wikipedia: Bouncy Castle (cryptography)]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cs.auckland.ac.nz/~pgut001/cryptlib/ Cryptlib] || a security toolkit that allows one to easily add encryption and authentication services to software&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cryptopp.com/ Crypto++] || a free C++ class library of cryptographic schemes&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.gnutls.org/ GnuTLS] || an LGPL-licensed TLS library with substantial documentation&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.libressl.org/ LibreSSL] || an OpenBSD fork of OpenSSL (Press coverage: [http://www.zdnet.com/openbsd-forks-prunes-fixes-openssl-7000028613/ ZDNet], [http://arstechnica.com/information-technology/2014/04/openssl-code-beyond-repair-claims-creator-of-libressl-fork/ Ars Technica])&lt;br /&gt;
|-&lt;br /&gt;
| [http://libtom.org/ LibTomCrypt] || public domain open source crypto library written in C&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mitls.org/wsgi miTLS] || a verified reference implementation of the TLS protocol. ([http://www.reddit.com/r/netsec/comments/1zn2d3/mitls_a_verified_reference_tls_implementation/ &amp;quot;reddit: miTLS - A verified reference TLS implementation&amp;quot;])&lt;br /&gt;
|-&lt;br /&gt;
| [http://nacl.cr.yp.to/ NaCl] || NaCl (pronounced &amp;quot;salt&amp;quot;) is a easy-to-use high-speed software library for network communication, encryption, decryption, and signatures&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mozilla.org/projects/security/pki/nss/ NSS] || a set of libraries designed to support cross-platform development of security-enabled client and server applications&lt;br /&gt;
|-&lt;br /&gt;
| [http://polarssl.org/ PolarSSL] || an SSL library that handles the complexities of the Secure Sockets Layer (SSL) protocol for an application ([[Wikipedia: PolarSSL]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.ohloh.net/projects/xyssl XySSL] || a C library providing a very small footprint crypto library and SSL implementation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Open Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source License, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://libevent.org/ libevent] || an event driven library which can [http://www.wangafu.net/~nickm/libevent-book/Ref6a_advanced_bufferevents.html#_bufferevents_and_ssl optionally use OpenSSL]&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Mod_ssl mod_ssl] || SSL/TLS module for the [http://en.wikipedia.org/wiki/Apache_HTTP_Server Apache HTTP Server]&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.stunnel.org/index.html Stunnel] || an SSL encryption wrapper between remote client and local (inetd-startable) or remote server&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Closed Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Closed Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Even if this section is empty now, it exist a numerous number of closed source products using OpenSSL.&lt;br /&gt;
&lt;br /&gt;
== Books and Documentation == &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Books and Documentation&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Title&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations Comparison of TLS implementations]  || Wikipedia article comparing various TLS libraries&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.keylength.com/ keylength.com]  || site which summarizes various key length recommendations&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.feistyduck.com/books/openssl-cookbook/ OpenSSL Cookbook]  || A free ebook that covers configuration and command-line usage (first&lt;br /&gt;
published in 2013; continuously updated)&lt;br /&gt;
|-&lt;br /&gt;
| [http://shop.oreilly.com/product/9780596002701.do Network Security with OpenSSL]  || O'Reilly book from 2002&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2030</id>
		<title>Related Links</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=Related_Links&amp;diff=2030"/>
		<updated>2014-11-09T10:09:35Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please feel free to edit this page and add your own OpenSSL-based project or product. This is the one place where otherwise extraneous mention of commercial products is appropriate. Note such mention does not constitute endorsement per our [[Commercial Product Disclaimer]].&lt;br /&gt;
&lt;br /&gt;
== Open Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source license, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://sourceforge.net/projects/amissl/ AmiSSL] || an OpenSSL port to AmigaOS&lt;br /&gt;
|-&lt;br /&gt;
| [http://botan.randombit.net/ Botan] || a C++ cryptography library which includes a TLS implementation&lt;br /&gt;
|-&lt;br /&gt;
| [https://boringssl.googlesource.com/boringssl/ BoringSSL] || a Google fork of OpenSSL ([https://www.imperialviolet.org/2014/06/20/boringssl.html Announcement ])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.bouncycastle.org/ Bouncy Castle] || cryptography API for Java and C# ([[Wikipedia: Bouncy Castle (cryptography)]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cs.auckland.ac.nz/~pgut001/cryptlib/ Cryptlib] || a security toolkit that allows one to easily add encryption and authentication services to software&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.cryptopp.com/ Crypto++] || a free C++ class library of cryptographic schemes&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.gnutls.org/ GnuTLS] || an LGPL-licensed TLS library with substantial documentation&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.libressl.org/ LibreSSL] || an OpenBSD fork of OpenSSL (Press coverage: [http://www.zdnet.com/openbsd-forks-prunes-fixes-openssl-7000028613/ ZDNet], [http://arstechnica.com/information-technology/2014/04/openssl-code-beyond-repair-claims-creator-of-libressl-fork/ Ars Technica])&lt;br /&gt;
|-&lt;br /&gt;
| [http://libtom.org/ LibTomCrypt] || public domain open source crypto library written in C&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mitls.org/wsgi miTLS] || a verified reference implementation of the TLS protocol. ([http://www.reddit.com/r/netsec/comments/1zn2d3/mitls_a_verified_reference_tls_implementation/ &amp;quot;reddit: miTLS - A verified reference TLS implementation&amp;quot;])&lt;br /&gt;
|-&lt;br /&gt;
| [http://nacl.cr.yp.to/ NaCl] || NaCl (pronounced &amp;quot;salt&amp;quot;) is a easy-to-use high-speed software library for network communication, encryption, decryption, and signatures&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.mozilla.org/projects/security/pki/nss/ NSS] || a set of libraries designed to support cross-platform development of security-enabled client and server applications&lt;br /&gt;
|-&lt;br /&gt;
| [http://polarssl.org/ PolarSSL] || an SSL library that handles the complexities of the Secure Sockets Layer (SSL) protocol for an application ([[Wikipedia: PolarSSL]])&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.ohloh.net/projects/xyssl XySSL] || a C library providing a very small footprint crypto library and SSL implementation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Open Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
Products which are available under some form of Open Source License, and which may also be available under some form of commercial license.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Open Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://libevent.org/ libevent] || an event driven library which can [http://www.wangafu.net/~nickm/libevent-book/Ref6a_advanced_bufferevents.html#_bufferevents_and_ssl optionally use OpenSSL]&lt;br /&gt;
|-&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Mod_ssl mod_ssl] || SSL/TLS module for the [http://en.wikipedia.org/wiki/Apache_HTTP_Server Apache HTTP Server]&lt;br /&gt;
|-&lt;br /&gt;
|[https://www.stunnel.org/index.html Stunnel] || an SSL encryption wrapper between remote client and local (inetd-startable) or remote server&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Closed Source Cryptographic Libraries ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Cryptographic Libraries&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Library&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Closed Source Products Using OpenSSL ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Closed Source Products Using OpenSSL&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Product&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.example.com No Entry]  || This is a placeholder&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Even if this section is empty now, it exist a numerous number of closed source products using OpenSSL.&lt;br /&gt;
&lt;br /&gt;
== Books and Documentation == &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
|+ Books and Documentation&lt;br /&gt;
|-&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; width=&amp;quot;150px&amp;quot; | Title&lt;br /&gt;
! scope=&amp;quot;col&amp;quot; class=&amp;quot;unsortable&amp;quot; | Description&lt;br /&gt;
|-&lt;br /&gt;
| [https://en.wikipedia.org/wiki/Comparison_of_TLS_implementations Comparison of TLS implementations]  || Wikipedia article comparing various TLS libraries&lt;br /&gt;
|-&lt;br /&gt;
| [http://www.keylength.com/ keylength.com]  || site which summarizes various key length recommendations&lt;br /&gt;
|-&lt;br /&gt;
| [https://www.feistyduck.com/books/openssl-cookbook/ OpenSSL Cookbook]  || A free ebook that covers configuration and command-line usage (first&lt;br /&gt;
published in 2013; continuously updated)&lt;br /&gt;
|-&lt;br /&gt;
| [http://shop.oreilly.com/product/9780596002701.do Network Security with OpenSSL]  || O'Reilly book from 2002&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Languages, Programs or libraries/Wrappers relying on openssl ==&lt;br /&gt;
&lt;br /&gt;
* '''libcurl''' http://curl.haxx.se/ which can use openssl&lt;br /&gt;
* '''PHP''' uses libcurl http://php.net/manual/en/intro.curl.php &lt;br /&gt;
* '''Python''' pyOpenSSL https://github.com/pyca/pyopenssl&lt;br /&gt;
* '''Perl''' Perl-Openssl http://sourceforge.net/projects/perl-openssl/ &lt;br /&gt;
* '''apache''' mod_ssl http://www.modssl.org/&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2026</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2026"/>
		<updated>2014-11-04T21:11:53Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* No Authentication Aka Anonymous */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
* How cipher suites are negotiated ? &lt;br /&gt;
&lt;br /&gt;
What TLS 1.2 rfc says : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      The single cipher suite selected by the server from the list in&lt;br /&gt;
      ClientHello.cipher_suites.  For resumed sessions, this field is&lt;br /&gt;
      the value from the state of the session being resumed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So basicaly server has the decision choice and does not provide a list of its own ciphersuites but just the selected one&lt;br /&gt;
&lt;br /&gt;
What are best ciphersuites to choose ?&lt;br /&gt;
&lt;br /&gt;
some interesting hint there : http://zombe.es/post/4078724716/openssl-cipher-selection&lt;br /&gt;
&lt;br /&gt;
* Is there a normalized cipher suite ordering ?&lt;br /&gt;
&lt;br /&gt;
not much more than what is told for 'How cipher suites are negotiated ?'&lt;br /&gt;
&lt;br /&gt;
So it is implementation dependent. In openssl there are two modes:&lt;br /&gt;
** default is to choose the first compatible cipher suite from client hello.&lt;br /&gt;
** SSL_OP_CIPHER_SERVER_PREFERENCE to SSL_CTX_set_option to choose from server cipher list order.&lt;br /&gt;
&lt;br /&gt;
* How to setup ciphersuites in openssl ?&lt;br /&gt;
&lt;br /&gt;
[[Manual:SSL_CTX_set_cipher_list(3)]] where string cipher parameter is described in [[Manual:ciphers(1)]]&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
=== No Authentication Aka Anonymous ===&lt;br /&gt;
&lt;br /&gt;
Even if it look like is a strange idea, it is possible to select cipher suite that does not provide any server authentication but still provide confidentiality.&lt;br /&gt;
&lt;br /&gt;
Selecting string cipher '''aNULL''' [[Manual:ciphers(1)]] allows to select such cipher suite. Remark this is not same a '''eNULL''' that provides no confidentiality at all.&lt;br /&gt;
&lt;br /&gt;
Anonymous Diffie_Hellman exchange ('''DH''') and Anonymous Elliptic Curves Diffie Hellman Exchange ('''ECDH''') methods provide this anonymous authentication.&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2025</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2025"/>
		<updated>2014-11-04T21:10:39Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* No Authentication Aka Anonymous */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
* How cipher suites are negotiated ? &lt;br /&gt;
&lt;br /&gt;
What TLS 1.2 rfc says : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      The single cipher suite selected by the server from the list in&lt;br /&gt;
      ClientHello.cipher_suites.  For resumed sessions, this field is&lt;br /&gt;
      the value from the state of the session being resumed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So basicaly server has the decision choice and does not provide a list of its own ciphersuites but just the selected one&lt;br /&gt;
&lt;br /&gt;
What are best ciphersuites to choose ?&lt;br /&gt;
&lt;br /&gt;
some interesting hint there : http://zombe.es/post/4078724716/openssl-cipher-selection&lt;br /&gt;
&lt;br /&gt;
* Is there a normalized cipher suite ordering ?&lt;br /&gt;
&lt;br /&gt;
not much more than what is told for 'How cipher suites are negotiated ?'&lt;br /&gt;
&lt;br /&gt;
So it is implementation dependent. In openssl there are two modes:&lt;br /&gt;
** default is to choose the first compatible cipher suite from client hello.&lt;br /&gt;
** SSL_OP_CIPHER_SERVER_PREFERENCE to SSL_CTX_set_option to choose from server cipher list order.&lt;br /&gt;
&lt;br /&gt;
* How to setup ciphersuites in openssl ?&lt;br /&gt;
&lt;br /&gt;
[[Manual:SSL_CTX_set_cipher_list(3)]] where string cipher parameter is described in [[Manual:ciphers(1)]]&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
=== No Authentication Aka Anonymous ===&lt;br /&gt;
&lt;br /&gt;
Even if it look like is a strange idea, it is possible to select cipher suite that does not provide any server authentication but still provide confidentiality.&lt;br /&gt;
&lt;br /&gt;
Selecting string cipher '''aNULL''' [[Manual:ciphers(1)]] allows to select such cipher suite. Remark this is not same a '''eNULL''' that provides no confidentiality at all.&lt;br /&gt;
&lt;br /&gt;
Anonymous Diffie_Hellman exchange and Anonymous Elliptic Curves Diffie Hellman Exchange methods provide this anonymous authentication.&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2024</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2024"/>
		<updated>2014-11-04T21:09:51Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Server Certificate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
* How cipher suites are negotiated ? &lt;br /&gt;
&lt;br /&gt;
What TLS 1.2 rfc says : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      The single cipher suite selected by the server from the list in&lt;br /&gt;
      ClientHello.cipher_suites.  For resumed sessions, this field is&lt;br /&gt;
      the value from the state of the session being resumed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So basicaly server has the decision choice and does not provide a list of its own ciphersuites but just the selected one&lt;br /&gt;
&lt;br /&gt;
What are best ciphersuites to choose ?&lt;br /&gt;
&lt;br /&gt;
some interesting hint there : http://zombe.es/post/4078724716/openssl-cipher-selection&lt;br /&gt;
&lt;br /&gt;
* Is there a normalized cipher suite ordering ?&lt;br /&gt;
&lt;br /&gt;
not much more than what is told for 'How cipher suites are negotiated ?'&lt;br /&gt;
&lt;br /&gt;
So it is implementation dependent. In openssl there are two modes:&lt;br /&gt;
** default is to choose the first compatible cipher suite from client hello.&lt;br /&gt;
** SSL_OP_CIPHER_SERVER_PREFERENCE to SSL_CTX_set_option to choose from server cipher list order.&lt;br /&gt;
&lt;br /&gt;
* How to setup ciphersuites in openssl ?&lt;br /&gt;
&lt;br /&gt;
[[Manual:SSL_CTX_set_cipher_list(3)]] where string cipher parameter is described in [[Manual:ciphers(1)]]&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
=== No Authentication Aka Anonymous ===&lt;br /&gt;
&lt;br /&gt;
Even if it look like is a strange idea, it is possible to select cipher suite that does not provide any server authentication but still provide confidentiality.&lt;br /&gt;
&lt;br /&gt;
Selecting string cipher 'aNULL' [[Manual:ciphers(1)]] allows to select such cipher suite. Remark this is not same a 'eNULL' that provides no confidentiality at all.&lt;br /&gt;
&lt;br /&gt;
Anonymous Diffie_Hellman exchange and Anonymous Elliptic Curves Diffie Hellman Exchange methods provide this anonymous authentication.&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2023</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2023"/>
		<updated>2014-11-04T20:58:21Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Cipher Suites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
* How cipher suites are negotiated ? &lt;br /&gt;
&lt;br /&gt;
What TLS 1.2 rfc says : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      The single cipher suite selected by the server from the list in&lt;br /&gt;
      ClientHello.cipher_suites.  For resumed sessions, this field is&lt;br /&gt;
      the value from the state of the session being resumed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So basicaly server has the decision choice and does not provide a list of its own ciphersuites but just the selected one&lt;br /&gt;
&lt;br /&gt;
What are best ciphersuites to choose ?&lt;br /&gt;
&lt;br /&gt;
some interesting hint there : http://zombe.es/post/4078724716/openssl-cipher-selection&lt;br /&gt;
&lt;br /&gt;
* Is there a normalized cipher suite ordering ?&lt;br /&gt;
&lt;br /&gt;
not much more than what is told for 'How cipher suites are negotiated ?'&lt;br /&gt;
&lt;br /&gt;
So it is implementation dependent. In openssl there are two modes:&lt;br /&gt;
** default is to choose the first compatible cipher suite from client hello.&lt;br /&gt;
** SSL_OP_CIPHER_SERVER_PREFERENCE to SSL_CTX_set_option to choose from server cipher list order.&lt;br /&gt;
&lt;br /&gt;
* How to setup ciphersuites in openssl ?&lt;br /&gt;
&lt;br /&gt;
[[Manual:SSL_CTX_set_cipher_list(3)]] where string cipher parameter is described in [[Manual:ciphers(1)]]&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2022</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2022"/>
		<updated>2014-11-04T20:58:04Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Cipher Suites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
* How cipher suites are negotiated ? &lt;br /&gt;
&lt;br /&gt;
What TLS 1.2 rfc says : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      The single cipher suite selected by the server from the list in&lt;br /&gt;
      ClientHello.cipher_suites.  For resumed sessions, this field is&lt;br /&gt;
      the value from the state of the session being resumed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So basicaly server has the decision choice and does not provide a list of its own ciphersuites but just the selected one&lt;br /&gt;
&lt;br /&gt;
What are best ciphersuites to choose ?&lt;br /&gt;
&lt;br /&gt;
some interesting hint there : http://zombe.es/post/4078724716/openssl-cipher-selection&lt;br /&gt;
&lt;br /&gt;
* Is there a normalized cipher suite ordering ?&lt;br /&gt;
&lt;br /&gt;
not much more than what is told for 'How cipher suites are negotiated ?'&lt;br /&gt;
&lt;br /&gt;
So it is implementation dependent. In openssl there are two modes:&lt;br /&gt;
* default is to choose the first compatible cipher suite from client hello.&lt;br /&gt;
* SSL_OP_CIPHER_SERVER_PREFERENCE to SSL_CTX_set_option to choose from server cipher list order.&lt;br /&gt;
&lt;br /&gt;
* How to setup ciphersuites in openssl ?&lt;br /&gt;
&lt;br /&gt;
[[Manual:SSL_CTX_set_cipher_list(3)]] where string cipher parameter is described in [[Manual:ciphers(1)]]&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2021</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2021"/>
		<updated>2014-11-04T18:07:55Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Cipher Suites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
* How cipher suites are negotiated ? &lt;br /&gt;
&lt;br /&gt;
What TLS 1.2 rfc says : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      The single cipher suite selected by the server from the list in&lt;br /&gt;
      ClientHello.cipher_suites.  For resumed sessions, this field is&lt;br /&gt;
      the value from the state of the session being resumed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So basicaly server has the decision choice and does not provide a list of its own ciphersuites but just the selected one&lt;br /&gt;
&lt;br /&gt;
What are best ciphersuites to choose ?&lt;br /&gt;
&lt;br /&gt;
some interesting hint there : http://zombe.es/post/4078724716/openssl-cipher-selection&lt;br /&gt;
&lt;br /&gt;
* Is there a normalized cipher suite ordering ?&lt;br /&gt;
&lt;br /&gt;
not much more than what is told for 'How cipher suites are negotiated ?'&lt;br /&gt;
&lt;br /&gt;
So it is implementation dependent. In openssl there are two modes:&lt;br /&gt;
* default is to choose the first compatible cipher suite from client hello.&lt;br /&gt;
* SSL_OP_CIPHER_SERVER_PREFERENCE to SSL_CTX_set_option to choose from server cipher list order.&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2020</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2020"/>
		<updated>2014-11-04T17:56:02Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Cipher Suites */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
How cipher suites are negotiated ? &lt;br /&gt;
&lt;br /&gt;
What are best ciphersuites to choose ?&lt;br /&gt;
&lt;br /&gt;
some interesting hint there : http://zombe.es/post/4078724716/openssl-cipher-selection&lt;br /&gt;
&lt;br /&gt;
* Is there a normalized cipher suite ordering ?&lt;br /&gt;
&lt;br /&gt;
What TLS 1.2 rfc says : &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
      The single cipher suite selected by the server from the list in&lt;br /&gt;
      ClientHello.cipher_suites.  For resumed sessions, this field is&lt;br /&gt;
      the value from the state of the session being resumed.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
not much.&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2019</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2019"/>
		<updated>2014-11-04T17:48:42Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Handshake */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Cipher Suites ==&lt;br /&gt;
&lt;br /&gt;
How cipher suites are negotiated ? &lt;br /&gt;
&lt;br /&gt;
What are best ciphersuites to choose ?&lt;br /&gt;
&lt;br /&gt;
some interesting hint there : http://zombe.es/post/4078724716/openssl-cipher-selection&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=BIO&amp;diff=2018</id>
		<title>BIO</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=BIO&amp;diff=2018"/>
		<updated>2014-11-01T07:37:30Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Combining Filters and Source Sink BIOs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A BIO is an I/O stream abstraction; essentially OpenSSL's answer to the C library's &amp;lt;code&amp;gt;FILE *&amp;lt;/code&amp;gt;.  OpenSSL comes with a number of useful BIO types predefined, or you can create your own.&lt;br /&gt;
&lt;br /&gt;
BIOs come in two flavors: source/sink, or filter.  BIOs can be chained together.  Each chain always has exactly one source/sink, but can have any number (zero or more) of filters.&lt;br /&gt;
&lt;br /&gt;
Reading from a BIO can be done with [[Manual:BIO_read(3)]] and &amp;lt;code&amp;gt;BIO_gets&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Writing to a BIO can be done with &amp;lt;code&amp;gt;BIO_write&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_puts&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_printf&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;BIO_vprintf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Filter BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_f_base64(3)]]&lt;br /&gt;
* [[Manual:BIO_f_buffer(3)]]&lt;br /&gt;
* [[Manual:BIO_f_cipher(3)]]&lt;br /&gt;
* [[Manual:BIO_f_md(3)]]&lt;br /&gt;
* [[Manual:BIO_f_ssl(3)]]&lt;br /&gt;
&lt;br /&gt;
== Source/sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_s_accept(3)]]&lt;br /&gt;
* [[Manual:BIO_s_bio(3)]]&lt;br /&gt;
* [[Manual:BIO_s_connect(3)]]&lt;br /&gt;
* [[Manual:BIO_s_fd(3)]]&lt;br /&gt;
* [[Manual:BIO_s_file(3)]]&lt;br /&gt;
* [[Manual:BIO_s_mem(3)]]&lt;br /&gt;
* [[Manual:BIO_s_null(3)]]&lt;br /&gt;
* [[Manual:BIO_s_socket(3)]]&lt;br /&gt;
&lt;br /&gt;
implementation of those bio are within bio/bss_xxx.c bss stading for Bio Source Sink&lt;br /&gt;
&lt;br /&gt;
== Combining Filters and Source Sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_push(3)]]&lt;br /&gt;
&lt;br /&gt;
new_head = BIO_push(BIO * local_head, BIO * tail) &lt;br /&gt;
&lt;br /&gt;
will connect tail at end of local_head chain.&lt;br /&gt;
&lt;br /&gt;
WARNING BIO_push will never fail, but can create invalid chains.&lt;br /&gt;
&lt;br /&gt;
In standard usage end of a chain is a source sink, and all other elements are filters.&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_s_bio(3)]]&lt;br /&gt;
&lt;br /&gt;
two separated BIOs can then be connected with BIO_make_bio_pair() into a connected pair.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=BIO&amp;diff=2017</id>
		<title>BIO</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=BIO&amp;diff=2017"/>
		<updated>2014-10-31T22:02:54Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Combining Filters and Source Sink BIOs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A BIO is an I/O stream abstraction; essentially OpenSSL's answer to the C library's &amp;lt;code&amp;gt;FILE *&amp;lt;/code&amp;gt;.  OpenSSL comes with a number of useful BIO types predefined, or you can create your own.&lt;br /&gt;
&lt;br /&gt;
BIOs come in two flavors: source/sink, or filter.  BIOs can be chained together.  Each chain always has exactly one source/sink, but can have any number (zero or more) of filters.&lt;br /&gt;
&lt;br /&gt;
Reading from a BIO can be done with [[Manual:BIO_read(3)]] and &amp;lt;code&amp;gt;BIO_gets&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Writing to a BIO can be done with &amp;lt;code&amp;gt;BIO_write&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_puts&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_printf&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;BIO_vprintf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Filter BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_f_base64(3)]]&lt;br /&gt;
* [[Manual:BIO_f_buffer(3)]]&lt;br /&gt;
* [[Manual:BIO_f_cipher(3)]]&lt;br /&gt;
* [[Manual:BIO_f_md(3)]]&lt;br /&gt;
* [[Manual:BIO_f_ssl(3)]]&lt;br /&gt;
&lt;br /&gt;
== Source/sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_s_accept(3)]]&lt;br /&gt;
* [[Manual:BIO_s_bio(3)]]&lt;br /&gt;
* [[Manual:BIO_s_connect(3)]]&lt;br /&gt;
* [[Manual:BIO_s_fd(3)]]&lt;br /&gt;
* [[Manual:BIO_s_file(3)]]&lt;br /&gt;
* [[Manual:BIO_s_mem(3)]]&lt;br /&gt;
* [[Manual:BIO_s_null(3)]]&lt;br /&gt;
* [[Manual:BIO_s_socket(3)]]&lt;br /&gt;
&lt;br /&gt;
implementation of those bio are within bio/bss_xxx.c bss stading for Bio Source Sink&lt;br /&gt;
&lt;br /&gt;
== Combining Filters and Source Sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_push(3)]]&lt;br /&gt;
&lt;br /&gt;
new_head = BIO_push(BIO * local_head, BIO * tail) &lt;br /&gt;
&lt;br /&gt;
will connect tail at end of local_head chain.&lt;br /&gt;
&lt;br /&gt;
WARNING BIO_push will never fail, but can create invalid chains.&lt;br /&gt;
&lt;br /&gt;
In standard usage end of a chain is a source sink, and all other elements are filters.&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_s_bio(3)]]&lt;br /&gt;
&lt;br /&gt;
Provide a way to combine half of one source sink with half of another to make sink communicate with source of the other.&lt;br /&gt;
&lt;br /&gt;
two separated BIOs can then be connected with BIO_make_bio_pair() into a connected pair.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=BIO&amp;diff=2016</id>
		<title>BIO</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=BIO&amp;diff=2016"/>
		<updated>2014-10-31T21:39:05Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Combining Filters and Source Sink BIOs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A BIO is an I/O stream abstraction; essentially OpenSSL's answer to the C library's &amp;lt;code&amp;gt;FILE *&amp;lt;/code&amp;gt;.  OpenSSL comes with a number of useful BIO types predefined, or you can create your own.&lt;br /&gt;
&lt;br /&gt;
BIOs come in two flavors: source/sink, or filter.  BIOs can be chained together.  Each chain always has exactly one source/sink, but can have any number (zero or more) of filters.&lt;br /&gt;
&lt;br /&gt;
Reading from a BIO can be done with [[Manual:BIO_read(3)]] and &amp;lt;code&amp;gt;BIO_gets&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Writing to a BIO can be done with &amp;lt;code&amp;gt;BIO_write&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_puts&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_printf&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;BIO_vprintf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Filter BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_f_base64(3)]]&lt;br /&gt;
* [[Manual:BIO_f_buffer(3)]]&lt;br /&gt;
* [[Manual:BIO_f_cipher(3)]]&lt;br /&gt;
* [[Manual:BIO_f_md(3)]]&lt;br /&gt;
* [[Manual:BIO_f_ssl(3)]]&lt;br /&gt;
&lt;br /&gt;
== Source/sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_s_accept(3)]]&lt;br /&gt;
* [[Manual:BIO_s_bio(3)]]&lt;br /&gt;
* [[Manual:BIO_s_connect(3)]]&lt;br /&gt;
* [[Manual:BIO_s_fd(3)]]&lt;br /&gt;
* [[Manual:BIO_s_file(3)]]&lt;br /&gt;
* [[Manual:BIO_s_mem(3)]]&lt;br /&gt;
* [[Manual:BIO_s_null(3)]]&lt;br /&gt;
* [[Manual:BIO_s_socket(3)]]&lt;br /&gt;
&lt;br /&gt;
implementation of those bio are within bio/bss_xxx.c bss stading for Bio Source Sink&lt;br /&gt;
&lt;br /&gt;
== Combining Filters and Source Sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_push(3)]]&lt;br /&gt;
&lt;br /&gt;
new_head = BIO_push(BIO * local_head, BIO * tail) &lt;br /&gt;
&lt;br /&gt;
will connect tail at end of local_head chain.&lt;br /&gt;
&lt;br /&gt;
WARNING BIO_push will never fail, but can create invalid chains.&lt;br /&gt;
&lt;br /&gt;
In standard usage end of a chain is a source sink, and all other elements are filters.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=BIO&amp;diff=2015</id>
		<title>BIO</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=BIO&amp;diff=2015"/>
		<updated>2014-10-31T21:31:56Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Combining Filters and Source Sink BIOS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A BIO is an I/O stream abstraction; essentially OpenSSL's answer to the C library's &amp;lt;code&amp;gt;FILE *&amp;lt;/code&amp;gt;.  OpenSSL comes with a number of useful BIO types predefined, or you can create your own.&lt;br /&gt;
&lt;br /&gt;
BIOs come in two flavors: source/sink, or filter.  BIOs can be chained together.  Each chain always has exactly one source/sink, but can have any number (zero or more) of filters.&lt;br /&gt;
&lt;br /&gt;
Reading from a BIO can be done with [[Manual:BIO_read(3)]] and &amp;lt;code&amp;gt;BIO_gets&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Writing to a BIO can be done with &amp;lt;code&amp;gt;BIO_write&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_puts&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_printf&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;BIO_vprintf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Filter BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_f_base64(3)]]&lt;br /&gt;
* [[Manual:BIO_f_buffer(3)]]&lt;br /&gt;
* [[Manual:BIO_f_cipher(3)]]&lt;br /&gt;
* [[Manual:BIO_f_md(3)]]&lt;br /&gt;
* [[Manual:BIO_f_ssl(3)]]&lt;br /&gt;
&lt;br /&gt;
== Source/sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_s_accept(3)]]&lt;br /&gt;
* [[Manual:BIO_s_bio(3)]]&lt;br /&gt;
* [[Manual:BIO_s_connect(3)]]&lt;br /&gt;
* [[Manual:BIO_s_fd(3)]]&lt;br /&gt;
* [[Manual:BIO_s_file(3)]]&lt;br /&gt;
* [[Manual:BIO_s_mem(3)]]&lt;br /&gt;
* [[Manual:BIO_s_null(3)]]&lt;br /&gt;
* [[Manual:BIO_s_socket(3)]]&lt;br /&gt;
&lt;br /&gt;
implementation of those bio are within bio/bss_xxx.c bss stading for Bio Source Sink&lt;br /&gt;
&lt;br /&gt;
== Combining Filters and Source Sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_push(3)]]&lt;br /&gt;
&lt;br /&gt;
new_head = BIO_push(BIO * local_head, BIO * tail) &lt;br /&gt;
&lt;br /&gt;
will connect tail at end of local_head chain.&lt;br /&gt;
&lt;br /&gt;
WARNING BIO_push will never fail, but can create invalid chains.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=BIO&amp;diff=2014</id>
		<title>BIO</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=BIO&amp;diff=2014"/>
		<updated>2014-10-31T21:17:31Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Combining Filters and Source Sink BIOS */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A BIO is an I/O stream abstraction; essentially OpenSSL's answer to the C library's &amp;lt;code&amp;gt;FILE *&amp;lt;/code&amp;gt;.  OpenSSL comes with a number of useful BIO types predefined, or you can create your own.&lt;br /&gt;
&lt;br /&gt;
BIOs come in two flavors: source/sink, or filter.  BIOs can be chained together.  Each chain always has exactly one source/sink, but can have any number (zero or more) of filters.&lt;br /&gt;
&lt;br /&gt;
Reading from a BIO can be done with [[Manual:BIO_read(3)]] and &amp;lt;code&amp;gt;BIO_gets&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Writing to a BIO can be done with &amp;lt;code&amp;gt;BIO_write&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_puts&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_printf&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;BIO_vprintf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Filter BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_f_base64(3)]]&lt;br /&gt;
* [[Manual:BIO_f_buffer(3)]]&lt;br /&gt;
* [[Manual:BIO_f_cipher(3)]]&lt;br /&gt;
* [[Manual:BIO_f_md(3)]]&lt;br /&gt;
* [[Manual:BIO_f_ssl(3)]]&lt;br /&gt;
&lt;br /&gt;
== Source/sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_s_accept(3)]]&lt;br /&gt;
* [[Manual:BIO_s_bio(3)]]&lt;br /&gt;
* [[Manual:BIO_s_connect(3)]]&lt;br /&gt;
* [[Manual:BIO_s_fd(3)]]&lt;br /&gt;
* [[Manual:BIO_s_file(3)]]&lt;br /&gt;
* [[Manual:BIO_s_mem(3)]]&lt;br /&gt;
* [[Manual:BIO_s_null(3)]]&lt;br /&gt;
* [[Manual:BIO_s_socket(3)]]&lt;br /&gt;
&lt;br /&gt;
implementation of those bio are within bio/bss_xxx.c bss stading for Bio Source Sink&lt;br /&gt;
&lt;br /&gt;
== Combining Filters and Source Sink BIOS ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_push(3)]]&lt;br /&gt;
&lt;br /&gt;
new_head = BIO_push(BIO * local_head, BIO * tail) &lt;br /&gt;
&lt;br /&gt;
will connect tail at end of local_head chain.&lt;br /&gt;
&lt;br /&gt;
WARNING BIO_push will never fail, but can  create totaly invalid chains.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=BIO&amp;diff=2013</id>
		<title>BIO</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=BIO&amp;diff=2013"/>
		<updated>2014-10-31T21:16:27Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Source/sink BIOs */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A BIO is an I/O stream abstraction; essentially OpenSSL's answer to the C library's &amp;lt;code&amp;gt;FILE *&amp;lt;/code&amp;gt;.  OpenSSL comes with a number of useful BIO types predefined, or you can create your own.&lt;br /&gt;
&lt;br /&gt;
BIOs come in two flavors: source/sink, or filter.  BIOs can be chained together.  Each chain always has exactly one source/sink, but can have any number (zero or more) of filters.&lt;br /&gt;
&lt;br /&gt;
Reading from a BIO can be done with [[Manual:BIO_read(3)]] and &amp;lt;code&amp;gt;BIO_gets&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Writing to a BIO can be done with &amp;lt;code&amp;gt;BIO_write&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_puts&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;BIO_printf&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;BIO_vprintf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Filter BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_f_base64(3)]]&lt;br /&gt;
* [[Manual:BIO_f_buffer(3)]]&lt;br /&gt;
* [[Manual:BIO_f_cipher(3)]]&lt;br /&gt;
* [[Manual:BIO_f_md(3)]]&lt;br /&gt;
* [[Manual:BIO_f_ssl(3)]]&lt;br /&gt;
&lt;br /&gt;
== Source/sink BIOs ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_s_accept(3)]]&lt;br /&gt;
* [[Manual:BIO_s_bio(3)]]&lt;br /&gt;
* [[Manual:BIO_s_connect(3)]]&lt;br /&gt;
* [[Manual:BIO_s_fd(3)]]&lt;br /&gt;
* [[Manual:BIO_s_file(3)]]&lt;br /&gt;
* [[Manual:BIO_s_mem(3)]]&lt;br /&gt;
* [[Manual:BIO_s_null(3)]]&lt;br /&gt;
* [[Manual:BIO_s_socket(3)]]&lt;br /&gt;
&lt;br /&gt;
implementation of those bio are within bio/bss_xxx.c bss stading for Bio Source Sink&lt;br /&gt;
&lt;br /&gt;
== Combining Filters and Source Sink BIOS ==&lt;br /&gt;
&lt;br /&gt;
* [[Manual:BIO_push(2)]]&lt;br /&gt;
&lt;br /&gt;
new_head = BIO_push(BIO * local_head, BIO * tail) &lt;br /&gt;
&lt;br /&gt;
will connect tail at end of local_head chain.&lt;br /&gt;
&lt;br /&gt;
WARNING BIO_push will never fail, but can  create totaly invalid chains.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2012</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2012"/>
		<updated>2014-10-30T18:07:22Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Renegotiation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
server renegotiation ( without resumption )&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Given a SSL Connection con : &lt;br /&gt;
SSL *con;&lt;br /&gt;
&lt;br /&gt;
SSL_renegotiate(con);&lt;br /&gt;
i=SSL_do_handshake(con);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To use both renegotiation and resumption use : SSL_renegotiate_abbreviated(con) which won't request to recreate a new session ( since 1.0.1 ).&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2011</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2011"/>
		<updated>2014-10-28T17:52:11Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Renegotiation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate :&lt;br /&gt;
&lt;br /&gt;
a Client will send a '''ClientHello''' over its existing SSL connection&lt;br /&gt;
&lt;br /&gt;
a Server will send a '''HelloRequest''' and expects Client to renegotiate with a ClientHello in very short time.&lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2010</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2010"/>
		<updated>2014-10-28T17:48:40Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Renegotiation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate a Client will send a '''ClientHello''' over its existing SSL connection; a Server will send a '''HelloRequest''' &lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
	<entry>
		<id>https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2009</id>
		<title>SSL and TLS Protocols</title>
		<link rel="alternate" type="text/html" href="https://wiki.openssl.org/index.php?title=SSL_and_TLS_Protocols&amp;diff=2009"/>
		<updated>2014-10-28T17:28:37Z</updated>

		<summary type="html">&lt;p&gt;Philippe lhardy: /* Public Key Certificate */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;SSL stands for Secure Sockets Layer and was originally created by Netscape. SSLv2 and SSLv3 are the 2 versions of this protocol (SSLv1 was never publicly release). After SSLv3, SSL was renamed to TLS.&lt;br /&gt;
&lt;br /&gt;
TLS stands for Transport Layer Security and started with TLSv1.0 which is an upgraded version of SSLv3.&lt;br /&gt;
&lt;br /&gt;
Those protocols are standardized and described by RFCs.&lt;br /&gt;
&lt;br /&gt;
OpenSSL provides an implementation for those protocols and is often used as the reference implementation for any new feature.&lt;br /&gt;
&lt;br /&gt;
The goal of SSL was to provide secure communication using classical TCP sockets with very few changes in API usage of sockets to be able to leverage security on existing TCP socket code.&lt;br /&gt;
&lt;br /&gt;
SSL/TLS is used in every browser worldwide to provide https ( http secure ) functionality.&lt;br /&gt;
&lt;br /&gt;
The latest standard version is TLSv1.2 http://tools.ietf.org/html/rfc5246, while the upcoming TLS v1.3 is still draft.&lt;br /&gt;
&lt;br /&gt;
Connectionless support is provided via DTLS.&lt;br /&gt;
&lt;br /&gt;
Those protocols are configurable and can use various ciphers depending on their version. &lt;br /&gt;
&lt;br /&gt;
== Security ==&lt;br /&gt;
&lt;br /&gt;
Besides implementation problems leading to security issues, there is security inherent to the protocol itself.&lt;br /&gt;
&lt;br /&gt;
It is recommended to run TLSv1.0, 1.1 or 1.2 and fully disable SSLv2 and SSLv3 that have protocol weaknesses.&lt;br /&gt;
&lt;br /&gt;
For the very same reason it is recommended to control protocol downgrade.&lt;br /&gt;
&lt;br /&gt;
=== POODLE : SSLv3 harmful ===&lt;br /&gt;
&lt;br /&gt;
[[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
&lt;br /&gt;
=== versions tricks ===&lt;br /&gt;
&lt;br /&gt;
==== SCSV ====&lt;br /&gt;
&lt;br /&gt;
Signaling cipher suite value (SCSV), i.e., it does not actually correspond to a suite of cryptosystems.&lt;br /&gt;
Its presence is used to signal some facts or contextual information allowing it to not break existing implementations that just ignore this unsupported cipher suite.&lt;br /&gt;
&lt;br /&gt;
SCSV was created with TLS_EMPTY_RENEGOTIATION_INFO_SCSV in rfc5746 draft. http://tools.ietf.org/html/rfc5746#section-3.3&lt;br /&gt;
Usage of a cipher suite value is explained by the fact that some SSLv3 and TLSv1.0 implementations fail to ignore extensions that they do not support, so using a cipher suite allows the bypass of these implementation problems. &lt;br /&gt;
&lt;br /&gt;
* TLS_EMPTY_RENEGOTIATION_INFO_SCSV 0x00 0xFF&lt;br /&gt;
openssl : SSL3_CK_SCSV&lt;br /&gt;
* TLS_FALLBACK_SCSV 0x56 0x00 See [[SSL MODE SEND FALLBACK SCSV]]&lt;br /&gt;
openssl : SSL3_CK_FALLBACK_SCSV&lt;br /&gt;
&lt;br /&gt;
== Handshake ==&lt;br /&gt;
&lt;br /&gt;
A connection always starts with a handshake between a client and a server. This handshake is intended to provide a secret key to both client and server that will be used to cipher the flow.&lt;br /&gt;
&lt;br /&gt;
In fact a '''master secret''' is obtained from the handshake from which the secret key is derived. In OpenSSL this master_secret is kept within the SSL Session '''SSL_SESSION'''.&lt;br /&gt;
&lt;br /&gt;
The initial handshake can provide server authentication, client authentication or no authentication at all.&lt;br /&gt;
&lt;br /&gt;
Default usage in HTTPS is to verify server authenticity with trusted Certificate Authorities known by the browser.&lt;br /&gt;
&lt;br /&gt;
A quick presentation for a classical TLS handshake ( RSA, without Session tickets and without client authentication ) under CC BY license http://blog.artisanlogiciel.net/public/tech/classical_handshake.odp feel free to improve it.&lt;br /&gt;
&lt;br /&gt;
== Session Resumption ==&lt;br /&gt;
&lt;br /&gt;
Since the handshake uses public key cryptography heavily and this is CPU intensive compared to symmetric ( secret key ) cryptography, the protocol provides ways to reuse existing credentials to reissue new secret keys for new connections ( new TCP connections ) or to renew existing connections. &lt;br /&gt;
&lt;br /&gt;
Browsers use this heavily when connecting to https sites since they open multiple connections to the same site at a time. The first connection does the handshake while all the others use a quick handshake (can be named '''resumed''', '''abbreviated''' or '''restart''' handshake)  allowing saving for  both client and server CPU.&lt;br /&gt;
&lt;br /&gt;
RFC 2246, section 7, p. 23&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   These items are then used to create security parameters for use by&lt;br /&gt;
   the Record Layer when protecting application data. Many connections&lt;br /&gt;
   can be instantiated using the same session through the resumption&lt;br /&gt;
   feature of the TLS Handshake Protocol.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This explains difference the between an OpenSSL SSL Connection ( '''SSL''' ) and an SSL Session ( '''SSL_SESSION''' ) , each SSL Connection runs on its TCP connection and can share the same SSL Session with other SSL connections.&lt;br /&gt;
&lt;br /&gt;
( to obtain session from connection use function :  [[Manual:SSL_get_session(3)|SSL_SESSION *SSL_get_session(const SSL *ssl)]] )&lt;br /&gt;
&lt;br /&gt;
== Renegotiation ==&lt;br /&gt;
&lt;br /&gt;
On a Ssl connection a renegotiation can occur to request for new cipher suites or key materials.&lt;br /&gt;
&lt;br /&gt;
To renegotiate a Client will send a '''ClientHello''' over its existing SSL connection; a Server will send a '''ServerHello''' &lt;br /&gt;
&lt;br /&gt;
It created a vulnerability that was addressed by TLS extension to notify server whenever a connection is renegotiating and allows to verify it is legit.&lt;br /&gt;
&lt;br /&gt;
This is RFC5746 &amp;quot;Transport Layer Security (TLS) Renegotiation Indication Extension&amp;quot; http://tools.ietf.org/html/rfc5746 to perform '''Secure Renegotiation'''&lt;br /&gt;
&lt;br /&gt;
== TLS Extensions ==&lt;br /&gt;
&lt;br /&gt;
=== Server Name Indication ===&lt;br /&gt;
&lt;br /&gt;
SNI Extension from [https://tools.ietf.org/rfc/rfc3546.txt RFC 3546, Transport Layer Security (TLS) Extensions].&lt;br /&gt;
&lt;br /&gt;
Allows a client to specify at the very beginning of the handshake  what server name it wants to connect to.&lt;br /&gt;
&lt;br /&gt;
This is very useful for a web server that serves multiple domains but doesn't have a wildcard certificate or a certificate containing a full list of supported domains.&lt;br /&gt;
&lt;br /&gt;
In this case the server can learn from the client what Certificate the client expects to receive.&lt;br /&gt;
&lt;br /&gt;
See how a C program can use [[Libssl API]] and provide SNI information with &lt;br /&gt;
'''&amp;lt;tt&amp;gt;SSL_set_tlsext_host_name&amp;lt;/tt&amp;gt;''' See example in [[SSL/TLS_Client]]&lt;br /&gt;
&lt;br /&gt;
== Server Authentication ==&lt;br /&gt;
&lt;br /&gt;
=== Server Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is '''Public Key''' Certified by a Certificate with Trust from client. Trust from client can be done automatically with Certificate Authority trust. &lt;br /&gt;
&lt;br /&gt;
It is crucial that clients check the Server Certificate against the expected hostname [[Hostname_validation]]&lt;br /&gt;
&lt;br /&gt;
== Client Authentication ==&lt;br /&gt;
&lt;br /&gt;
Client authentication is optional. in many cases client does not authenticaiton at ssl layer, but with usage of protocols above ssl by exemple with HTTP authenticate methods.&lt;br /&gt;
&lt;br /&gt;
=== Client Certificates ===&lt;br /&gt;
&lt;br /&gt;
* Certificate Request ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.4 )&lt;br /&gt;
Server can send a Certificate Request with digest algorithms and a list CA Distinguished names which will be used by the client to select the Client Certificate it will send.&lt;br /&gt;
&lt;br /&gt;
* Client Certificate ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.6)&lt;br /&gt;
Client send its Client Certificate first then all intermediate Certificates, if any, up to the CA ( optionally excluded ).&lt;br /&gt;
&lt;br /&gt;
* CertificateVerify ( TLS v1.2 http://tools.ietf.org/html/rfc5246#section-7.4.8 )&lt;br /&gt;
The Client sends a Certificate Verify that is signed by the private key counterpart of its Client public key included in the Certificate with digest algorithm over whole handshake messages so far ( excluding this one of course ).&lt;br /&gt;
 &lt;br /&gt;
This proves that this client owns the private key that applies to this specific handshake and hence authenticates the client for this session.&lt;br /&gt;
&lt;br /&gt;
== Alternate Authentication Methods ==&lt;br /&gt;
&lt;br /&gt;
=== Public Key Certificate ===&lt;br /&gt;
&lt;br /&gt;
This is the most commonly used method. With X509 Certificates and Certficate Authorities.&lt;br /&gt;
&lt;br /&gt;
It applies To '''Server Certificate''' or to '''Client Certificate''' authentication. &lt;br /&gt;
&lt;br /&gt;
Depending on CipherSuite, for Server Public Key can be used to derive pre-master-key.&lt;br /&gt;
&lt;br /&gt;
=== Pre-Shared Keys ===&lt;br /&gt;
&lt;br /&gt;
TLS PSK Pre Shared Key&lt;br /&gt;
&lt;br /&gt;
=== Kerberos ===&lt;br /&gt;
&lt;br /&gt;
=== Password ===&lt;br /&gt;
&lt;br /&gt;
TLS SRP : Secure Remote Password. Allows authentication with a password over TLS.&lt;br /&gt;
&lt;br /&gt;
Supported by OpenSSL with version 1.0.1.&lt;br /&gt;
&lt;br /&gt;
RFC5054&lt;br /&gt;
&lt;br /&gt;
TLS SRP is negotiated with various ciphersuites, currently all use SHA to compute SRP.&lt;br /&gt;
&lt;br /&gt;
With SRP trust is based on the fact that both parties should know the password ( or Password Verifier ) to complete the SRP Verify Handshake.&lt;br /&gt;
&lt;br /&gt;
It is possible to use RSA or DSS additionaly to prove Server identity with Certificates.&lt;/div&gt;</summary>
		<author><name>Philippe lhardy</name></author>
	</entry>
</feed>