From 07ae4f993de7dc717aec096943aa91b9029bada3 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Fri, 8 Dec 2017 15:16:41 +0100 Subject: ssl: Document DTLS --- lib/ssl/doc/src/ssl.xml | 80 +++++++++++++++++++----------------- lib/ssl/doc/src/ssl_app.xml | 6 +-- lib/ssl/doc/src/ssl_distribution.xml | 50 +++++++++++----------- lib/ssl/doc/src/ssl_introduction.xml | 7 ++-- lib/ssl/doc/src/ssl_protocol.xml | 24 ++++++----- lib/ssl/doc/src/using_ssl.xml | 34 +++++++-------- 6 files changed, 104 insertions(+), 97 deletions(-) (limited to 'lib/ssl/doc/src') diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml index 8fcda78ed5..ebef8bd69a 100644 --- a/lib/ssl/doc/src/ssl.xml +++ b/lib/ssl/doc/src/ssl.xml @@ -32,7 +32,7 @@ Interface Functions for Secure Socket Layer

- This module contains interface functions for the SSL/TLS protocol. + This module contains interface functions for the SSL/TLS/DTLS protocol. For detailed information about the supported standards see ssl(6).

@@ -40,7 +40,7 @@
DATA TYPES -

The following data types are used in the functions for SSL:

+

The following data types are used in the functions for SSL/TLS/DTLS:

@@ -56,9 +56,11 @@

The default socket options are [{mode,list},{packet, 0},{header, 0},{active, true}].

For valid options, see the - inet(3) and - gen_tcp(3) manual pages - in Kernel.

+ inet(3), + gen_tcp(3) and + gen_udp(3) + manual pages + in Kernel. Note that stream oriented options such as packet are only relevant for SSL/TLS and not DTLS

ssl_option() = @@ -95,13 +97,14 @@

{cb_info, {CallbackModule::atom(), DataTag::atom(), ClosedTag::atom(), ErrTag:atom()}}

-

Defaults to {gen_tcp, tcp, tcp_closed, tcp_error}. Can be used - to customize the transport layer. The callback module must implement a +

Defaults to {gen_tcp, tcp, tcp_closed, tcp_error} for TLS + and {gen_udp, udp, udp_closed, udp_error} for DTLS. Can be used + to customize the transport layer. For TLS the callback module must implement a reliable transport protocol, behave as gen_tcp, and have functions corresponding to inet:setopts/2, inet:getopts/2, inet:peername/1, inet:sockname/1, and inet:port/1. The callback gen_tcp is treated specially and calls inet - directly.

+ directly.

For DTLS this feature must be considered exprimental. CallbackModule =

atom()

@@ -184,7 +187,7 @@
- SSL OPTION DESCRIPTIONS - COMMON for SERVER and CLIENT + TLS/DTLS OPTION DESCRIPTIONS - COMMON for SERVER and CLIENT

The following options have the same meaning in the client and the server:

@@ -289,11 +292,11 @@ atom()}} |

If the verify callback fun returns {fail, Reason}, the verification process is immediately stopped, an alert is - sent to the peer, and the TLS/SSL handshake terminates.

+ sent to the peer, and the TLS/DTLS handshake terminates.

If the verify callback fun returns {valid, UserState}, the verification process continues.

If the verify callback fun always returns - {valid, UserState}, the TLS/SSL handshake does not + {valid, UserState}, the TLS/DTLS handshake does not terminate regarding verification failures and the connection is established.

If called with an extension unknown to the user application, @@ -464,7 +467,7 @@ marker="public_key:public_key#pkix_path_validation-3">public_key:pkix_path_valid See also ssl(6).

{hibernate_after, integer()|undefined} -

When an integer-value is specified, ssl_connection +

When an integer-value is specified, TLS/DTLS-connection goes into hibernation after the specified number of milliseconds of inactivity, thus reducing its memory footprint. When undefined is specified (this is the default), the process @@ -524,7 +527,7 @@ fun(srp, Username :: string(), UserState :: term()) ->

- SSL OPTION DESCRIPTIONS - CLIENT SIDE + TLS/DTLS OPTION DESCRIPTIONS - CLIENT SIDE

The following options are client-specific or have a slightly different meaning in the client than in the server:

@@ -664,7 +667,7 @@ fun(srp, Username :: string(), UserState :: term()) ->
- SSL OPTION DESCRIPTIONS - SERVER SIDE + TLS/DTLS OPTION DESCRIPTIONS - SERVER SIDE

The following options are server-specific or have a slightly different meaning in the server than in the client:

@@ -702,7 +705,7 @@ fun(srp, Username :: string(), UserState :: term()) ->

{fail_if_no_peer_cert, boolean()} -

Used together with {verify, verify_peer} by an SSL server. +

Used together with {verify, verify_peer} by an TLS/DTLS server. If set to true, the server fails if the client does not have a certificate to send, that is, sends an empty certificate. If set to false, it fails only if the client sends an invalid @@ -716,7 +719,7 @@ fun(srp, Username :: string(), UserState :: term()) -> {reuse_session, fun(SuggestedSessionId, PeerCert, Compression, CipherSuite) -> boolean()} -

Enables the SSL server to have a local policy +

Enables the TLS/DTLS server to have a local policy for deciding if a session is to be reused or not. Meaningful only if reuse_sessions is set to true. SuggestedSessionId is a binary(), PeerCert is @@ -814,7 +817,7 @@ fun(srp, Username :: string(), UserState :: term()) ->

General -

When an SSL socket is in active mode (the default), data from the +

When an TLS/DTLS socket is in active mode (the default), data from the socket is delivered to the owner of the socket in the form of messages:

@@ -872,20 +875,20 @@ fun(srp, Username :: string(), UserState :: term()) -> connect(Socket, SslOptions) -> - connect(Socket, SslOptions, Timeout) -> {ok, SslSocket} + connect(Socket, SslOptions, Timeout) -> {ok, TLSSocket} | {error, Reason} Upgrades a gen_tcp, or - equivalent, connected socket to an SSL socket. + equivalent, connected socket to an TLS socket. Socket = socket() SslOptions = [ssl_option()] Timeout = integer() | infinity - SslSocket = sslsocket() + TLSSocket = sslsocket() Reason = term()

Upgrades a gen_tcp, or equivalent, - connected socket to an SSL socket, that is, performs the - client-side ssl handshake.

+ connected socket to an TLS socket, that is, performs the + client-side TLS handshake.

If the option verify is set to verify_peer the option server_name_indication shall also be specified, @@ -899,7 +902,7 @@ fun(srp, Username :: string(), UserState :: term()) -> connect(Host, Port, Options) -> connect(Host, Port, Options, Timeout) -> {ok, SslSocket} | {error, Reason} - Opens an SSL connection to Host, Port. + Opens an TLS/DTLS connection to Host, Port. Host = host() Port = integer() @@ -908,7 +911,7 @@ fun(srp, Username :: string(), UserState :: term()) -> SslSocket = sslsocket() Reason = term() -

Opens an SSL connection to Host, Port.

+

Opens an TLS/DTLS connection to Host, Port.

When the option verify is set to verify_peer the check public_key:pkix_verify_hostname/2 @@ -930,24 +933,24 @@ fun(srp, Username :: string(), UserState :: term()) -> close(SslSocket) -> ok | {error, Reason} - Closes an SSL connection. + Closes an TLS/DTLS connection. SslSocket = sslsocket() Reason = term() -

Closes an SSL connection.

+

Closes an TLS/DTLS connection.

close(SslSocket, How) -> ok | {ok, port()} | {error, Reason} - Closes an SSL connection. + Closes an TLS connection. SslSocket = sslsocket() How = timeout() | {NewController::pid(), timeout()} Reason = term() -

Closes or downgrades an SSL connection. In the latter case the transport +

Closes or downgrades an TLS connection. In the latter case the transport connection will be handed over to the NewController process after receiving the TLS close alert from the peer. The returned transport socket will have the following options set: [{active, false}, {packet, 0}, {mode, binary}]

@@ -958,7 +961,7 @@ fun(srp, Username :: string(), UserState :: term()) -> controlling_process(SslSocket, NewOwner) -> ok | {error, Reason} Assigns a new controlling process to the - SSL socket. + TLS/DTLS socket. SslSocket = sslsocket() NewOwner = pid() @@ -1121,7 +1124,7 @@ fun(srp, Username :: string(), UserState :: term()) -> extra key material. It either takes user-generated values for Secret and Seed or atoms directing it to use a specific value from the session security parameters.

-

Can only be used with TLS connections; {error, undefined} +

Can only be used with TLS/DTLS connections; {error, undefined} is returned for SSLv3 connections.

@@ -1221,7 +1224,7 @@ fun(srp, Username :: string(), UserState :: term()) -> Reason = term() -

Performs the SSL/TLS server-side handshake.

+

Performs the SSL/TLS/DTLS server-side handshake.

Socket is a socket as returned by ssl:transport_accept/[1,2]

@@ -1231,7 +1234,7 @@ fun(srp, Username :: string(), UserState :: term()) -> ssl_accept(Socket, SslOptions) -> ssl_accept(Socket, SslOptions, Timeout) -> {ok, Socket} | ok | {error, Reason} - Performs server-side SSL/TLS handshake. + Performs server-side SSL/TLS/DTLS handshake. Socket = socket() | sslsocket() SslOptions = [ssl_option()] @@ -1248,10 +1251,10 @@ fun(srp, Username :: string(), UserState :: term()) -> by calling this function, else the upgrade succeeds or does not succeed depending on timing.

-

If Socket is an sslsocket(): provides extra SSL/TLS +

If Socket is an sslsocket(): provides extra SSL/TLS/DTLS options to those specified in ssl:listen/2 and then performs - the SSL/TLS handshake. + the SSL/TLS/DTLS handshake.

@@ -1310,7 +1313,7 @@ fun(srp, Username :: string(), UserState :: term()) -> The socket returned is to be passed to ssl:ssl_accept[2,3] to complete handshaking, that is, - establishing the SSL/TLS connection.

+ establishing the SSL/TLS/DTLS connection.

The socket returned can only be used with ssl:ssl_accept[2,3]. @@ -1342,17 +1345,17 @@ fun(srp, Username :: string(), UserState :: term()) -> The application version of the SSL application. supported - TLS/SSL versions supported by default. + SSL/TLS/DTLS versions supported by default. Overridden by a version option on connect/[2,3,4], listen/2, and ssl_accept/[1,2,3]. - For the negotiated TLS/SSL version, see ssl:connection_information/1 . available - All TLS/SSL versions supported by the SSL application. + All SSL/TLS/DTLS versions supported by the SSL application. TLS 1.2 requires sufficient support from the Crypto application. @@ -1365,6 +1368,7 @@ fun(srp, Username :: string(), UserState :: term()) -> SEE ALSO

inet(3) and gen_tcp(3) + gen_udp(3)

diff --git a/lib/ssl/doc/src/ssl_app.xml b/lib/ssl/doc/src/ssl_app.xml index f317dfded4..07cbfb3bd9 100644 --- a/lib/ssl/doc/src/ssl_app.xml +++ b/lib/ssl/doc/src/ssl_app.xml @@ -38,8 +38,8 @@ The ssl application is an implementation of the SSL/TLS protocol in Erlang.

- Supported SSL/TLS-versions are SSL-3.0, TLS-1.0, - TLS-1.1, and TLS-1.2. + Supported SSL/TLS/DTLS-versions are SSL-3.0, TLS-1.0, + TLS-1.1, TLS-1.2, DTLS-1.0 (based on TLS-1.1), DTLS-1.2 (based on TLS-1.2) For security reasons SSL-2.0 is not supported. For security reasons SSL-3.0 is no longer supported by default, but can be configured. @@ -167,7 +167,7 @@ ERROR LOGGER AND EVENT HANDLERS

The SSL application uses the default OTP error logger to log - unexpected errors and TLS alerts. The logging of TLS alerts may be + unexpected errors and TLS/DTLS alerts. The logging of TLS/DTLS alerts may be turned off with the log_alert option.

diff --git a/lib/ssl/doc/src/ssl_distribution.xml b/lib/ssl/doc/src/ssl_distribution.xml index 7f8a08f704..e14f3f90dc 100644 --- a/lib/ssl/doc/src/ssl_distribution.xml +++ b/lib/ssl/doc/src/ssl_distribution.xml @@ -22,7 +22,7 @@ - Using SSL for Erlang Distribution + Using TLS for Erlang Distribution P Nyblom @@ -33,7 +33,7 @@ ssl_distribution.xml

This section describes how the Erlang distribution can use - SSL to get extra verification and security.

+ TLS to get extra verification and security.

The Erlang distribution can in theory use almost any connection-based protocol as bearer. However, a module that @@ -45,16 +45,16 @@

In the SSL application, an extra distribution module, inet_tls_dist, can be used as an - alternative. All distribution connections will use SSL and + alternative. All distribution connections will use TLS and all participating Erlang nodes in a distributed system must use this distribution module.

The security level depends on the parameters provided to the - SSL connection setup. Erlang node cookies are however always + TLS connection setup. Erlang node cookies are however always used, as they can be used to differentiate between two different Erlang networks.

-

To set up Erlang distribution over SSL:

+

To set up Erlang distribution over TLS:

Step 1: Build boot scripts including the @@ -63,13 +63,13 @@ net_kernel. Step 3: Specify the security options and other SSL options. - Step 4: Set up the environment to always use SSL. + Step 4: Set up the environment to always use TLS.

The following sections describe these steps.

- Building Boot Scripts Including the ssl Application + Building Boot Scripts Including the SSL Application

Boot scripts are built using the systools utility in the SASL application. For more information on systools, see the SASL documentation. This is only an example of @@ -90,7 +90,7 @@ STDLIB application.

-

The following shows an example .rel file with SSL +

The following shows an example .rel file with TLS added:

{release, {"OTP APN 181 01","R15A"}, {erts, "5.9"}, @@ -154,7 +154,7 @@ Eshell V5.0 (abort with ^G)
Specifying Distribution Module for net_kernel -

The distribution module for SSL is named inet_tls_dist +

The distribution module for SSL/TLS is named inet_tls_dist and is specified on the command line with option -proto_dist. The argument to -proto_dist is to be the module name without suffix _dist. So, this distribution @@ -174,21 +174,21 @@ Eshell V5.0 (abort with ^G) (ssl_test@myhost)1>

However, a node started in this way refuses to talk - to other nodes, as no SSL parameters are supplied + to other nodes, as no TLS parameters are supplied (see the next section).

- Specifying SSL Options + Specifying SSL/TLS Options

- The SSL distribution options can be written into a file + The SSL/TLS distribution options can be written into a file that is consulted when the node is started. This file name is then specified with the command line argument -ssl_dist_optfile.

- Any available SSL option can be specified in an options file, + Any available SSL/TLS option can be specified in an options file, but note that options that take a fun() has to use the syntax fun Mod:Func/Arity since a function body can not be compiled when consulting a file. @@ -202,7 +202,7 @@ Eshell V5.0 (abort with ^G) interfere severely, so beware!

- For SSL to work, at least a public key and a certificate + For SSL/TLS to work, at least a public key and a certificate must be specified for the server side. In the following example, the PEM file "/home/me/ssl/erlserver.pem" contains both @@ -257,13 +257,13 @@ $ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls still be accepted if it does not present any certificate.

- A node started in this way is fully functional, using SSL + A node started in this way is fully functional, using TLS as the distribution protocol.

- Specifying SSL Options (Legacy) + Specifying SSL/TLS Options (Legacy)

As in the previous section the PEM file @@ -272,9 +272,9 @@ $ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls

On the erl command line you can specify options that the - SSL distribution adds when creating a socket.

+ SSL/TLS distribution adds when creating a socket.

-

The simplest SSL options in the following list can be specified +

The simplest SSL/TLS options in the following list can be specified by adding the prefix server_ or client_ to the option name:

@@ -294,7 +294,7 @@ $ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls

Note that verify_fun needs to be written in a different - form than the corresponding SSL option, since funs are not + form than the corresponding SSL/TLS option, since funs are not accepted on the command line.

The server can also take the options dhfile and @@ -307,7 +307,7 @@ $ erl -boot /home/me/ssl/start_ssl -proto_dist inet_tls

Raw socket options, such as packet and size must not be specified on the command line.

-

The command-line argument for specifying the SSL options is named +

The command-line argument for specifying the SSL/TLS options is named -ssl_dist_opt and is to be followed by pairs of SSL options and their values. Argument -ssl_dist_opt can be repeated any number of times.

@@ -331,10 +331,10 @@ Eshell V5.0 (abort with ^G)
- Setting up Environment to Always Use SSL (Legacy) + Setting up Environment to Always Use SSL/TLS (Legacy)

A convenient way to specify arguments to Erlang is to use environment variable ERL_FLAGS. All the flags needed to - use the SSL distribution can be specified in that variable and are + use the SSL/TLS distribution can be specified in that variable and are then interpreted as command-line arguments for all subsequent invocations of Erlang.

@@ -365,8 +365,8 @@ Eshell V5.0 (abort with ^G)
- Using SSL distribution over IPv6 -

It is possible to use SSL distribution over IPv6 instead of + Using SSL/TLS distribution over IPv6 +

It is possible to use SSL/TLS distribution over IPv6 instead of IPv4. To do this, pass the option -proto_dist inet6_tls instead of -proto_dist inet_tls when starting Erlang, either on the command line or in the ERL_FLAGS environment @@ -380,6 +380,6 @@ $ erl -boot /home/me/ssl/start_ssl -proto_dist inet6_tls

A node started in this way will only be able to communicate with - other nodes using SSL distribution over IPv6.

+ other nodes using SSL/TLS distribution over IPv6.

diff --git a/lib/ssl/doc/src/ssl_introduction.xml b/lib/ssl/doc/src/ssl_introduction.xml index d3e39dbb01..bbb1c276cc 100644 --- a/lib/ssl/doc/src/ssl_introduction.xml +++ b/lib/ssl/doc/src/ssl_introduction.xml @@ -5,7 +5,7 @@
2015 - 2015 + 2017 Ericsson AB, All Rights Reserved @@ -41,14 +41,15 @@ authenticate the counterpart with whom they communicate, and to exchange a symmetric key for payload encryption. The protocol provides data/message confidentiality (encryption), integrity (through message authentication code checks) - and host verification (through certificate path validation).

+ and host verification (through certificate path validation). DTLS (Datagram Transport Layer Security) that + is based on TLS but datagram oriented instead of stream oriented.

Prerequisites

It is assumed that the reader is familiar with the Erlang programming language, the concepts of OTP, and has a basic - understanding of SSL/TLS.

+ understanding of SSL/TLS/DTLS.

diff --git a/lib/ssl/doc/src/ssl_protocol.xml b/lib/ssl/doc/src/ssl_protocol.xml index 31a22db58b..0b12dc7dc5 100644 --- a/lib/ssl/doc/src/ssl_protocol.xml +++ b/lib/ssl/doc/src/ssl_protocol.xml @@ -22,7 +22,7 @@ - TLS and its Predecessor, SSL + TLS/DTLS and TLS Predecessor, SSL @@ -33,7 +33,7 @@ ssl_protocol.xml -

The Erlang SSL application implements the SSL/TLS protocol +

The Erlang SSL application implements the SSL/TLS/DTLS protocol for the currently supported versions, see the ssl(3) manual page.

@@ -41,20 +41,22 @@

By default SSL/TLS is run over the TCP/IP protocol even though you can plug in any other reliable transport protocol with the same Application Programming Interface (API) as the - gen_tcp module in Kernel.

+ gen_tcp module in Kernel. DTLS is by default run over UDP/IP, + which means that application data has no delivery guarentees. Other + transports, such as SCTP, may be supported in future releases.

If a client and a server wants to use an upgrade mechanism, such as - defined by RFC 2817, to upgrade a regular TCP/IP connection to an SSL + defined by RFC 2817, to upgrade a regular TCP/IP connection to an TLS connection, this is supported by the Erlang SSL application API. This can be useful for, for example, supporting HTTP and HTTPS on the same port and - implementing virtual hosting. + implementing virtual hosting. Note this is a TLS feature only.

Security Overview

To achieve authentication and privacy, the client and server - perform a TLS handshake procedure before transmitting or receiving + perform a TLS/DTLS handshake procedure before transmitting or receiving any data. During the handshake, they agree on a protocol version and cryptographic algorithms, generate shared secrets using public key cryptographies, and optionally authenticate each other with @@ -73,10 +75,10 @@

The keys for the symmetric encryption are generated uniquely for each connection and are based on a secret negotiated - in the TLS handshake.

+ in the TLS/DTLS handshake.

-

The TLS handshake protocol and data transfer is run on top of - the TLS Record Protocol, which uses a keyed-hash Message +

The TLS/DTLS handshake protocol and data transfer is run on top of + the TLS/DTLS Record Protocol, which uses a keyed-hash Message Authenticity Code (MAC), or a Hash-based MAC (HMAC), to protect the message data integrity. From the TLS RFC: "A Message Authentication Code is a @@ -152,8 +154,8 @@ from it was saved, for security reasons. The amount of time the session data is to be saved can be configured.

-

By default the SSL clients try to reuse an available session and - by default the SSL servers agree to reuse sessions when clients +

By default the TLS/DTLS clients try to reuse an available session and + by default the TLS/DTLS servers agree to reuse sessions when clients ask for it.

diff --git a/lib/ssl/doc/src/using_ssl.xml b/lib/ssl/doc/src/using_ssl.xml index f84cd6e391..ea5811fe34 100644 --- a/lib/ssl/doc/src/using_ssl.xml +++ b/lib/ssl/doc/src/using_ssl.xml @@ -22,7 +22,7 @@ - Using SSL API + Using SSL application API @@ -51,7 +51,7 @@
Minimal Example -

The minimal setup is not the most secure setup of SSL.

+

The minimal setup is not the most secure setup of SSL/TLS/DTLS.

To set up client/server connections:

@@ -60,27 +60,27 @@ 1 server> ssl:start(). ok -

Step 2: Create an SSL listen socket:

+

Step 2: Create an TLS listen socket: (To run DTLS add the option {protocol, dtls})

2 server> {ok, ListenSocket} = ssl:listen(9999, [{certfile, "cert.pem"}, {keyfile, "key.pem"},{reuseaddr, true}]). {ok,{sslsocket, [...]}} -

Step 3: Do a transport accept on the SSL listen socket:

+

Step 3: Do a transport accept on the TLS listen socket:

3 server> {ok, Socket} = ssl:transport_accept(ListenSocket). {ok,{sslsocket, [...]}} -

Step 4: Start the client side:

+

Step 4: Start the client side:

1 client> ssl:start(). ok - +

To run DTLS add the option {protocol, dtls} to third argument.

2 client> {ok, Socket} = ssl:connect("localhost", 9999, [], infinity). {ok,{sslsocket, [...]}} -

Step 5: Do the SSL handshake:

+

Step 5: Do the TLS handshake:

4 server> ok = ssl:ssl_accept(Socket). ok -

Step 6: Send a message over SSL:

+

Step 6: Send a message over TLS:

5 server> ssl:send(Socket, "foo"). ok @@ -92,7 +92,7 @@ ok
- Upgrade Example + Upgrade Example - TLS only

To upgrade a TCP/IP connection to an SSL connection, the client and server must agree to do so. The agreement @@ -125,24 +125,24 @@ ok 4 server> inet:setopts(Socket, [{active, false}]). ok -

Step 6: Do the SSL handshake:

- 5 server> {ok, SSLSocket} = ssl:ssl_accept(Socket, [{cacertfile, "cacerts.pem"}, +

Step 6: Do the TLS handshake:

+ 5 server> {ok, TLSSocket} = ssl:ssl_accept(Socket, [{cacertfile, "cacerts.pem"}, {certfile, "cert.pem"}, {keyfile, "key.pem"}]). {ok,{sslsocket,[...]}} -

Step 7: Upgrade to an SSL connection. The client and server +

Step 7: Upgrade to an TLS connection. The client and server must agree upon the upgrade. The server must call ssl:accept/2 before the client calls ssl:connect/3.

- 3 client>{ok, SSLSocket} = ssl:connect(Socket, [{cacertfile, "cacerts.pem"}, + 3 client>{ok, TLSSocket} = ssl:connect(Socket, [{cacertfile, "cacerts.pem"}, {certfile, "cert.pem"}, {keyfile, "key.pem"}], infinity). {ok,{sslsocket,[...]}} -

Step 8: Send a message over SSL:

- 4 client> ssl:send(SSLSocket, "foo"). +

Step 8: Send a message over TLS:

+ 4 client> ssl:send(TLSSocket, "foo"). ok -

Step 9: Set active true on the SSL socket:

- 4 server> ssl:setopts(SSLSocket, [{active, true}]). +

Step 9: Set active true on the TLS socket:

+ 4 server> ssl:setopts(TLSSocket, [{active, true}]). ok

Step 10: Flush the shell message queue to see that the message -- cgit v1.2.3 From 9a67fbf96da78df54bd18d487c6237256b8bef60 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Fri, 8 Dec 2017 15:17:17 +0100 Subject: ssl: Document enhancment --- lib/ssl/doc/src/ssl_app.xml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'lib/ssl/doc/src') diff --git a/lib/ssl/doc/src/ssl_app.xml b/lib/ssl/doc/src/ssl_app.xml index 07cbfb3bd9..e79b79a434 100644 --- a/lib/ssl/doc/src/ssl_app.xml +++ b/lib/ssl/doc/src/ssl_app.xml @@ -72,7 +72,7 @@

DEPENDENCIES -

The SSL application uses the public_key and +

The SSL application uses the public_key, asn1 and Crypto application to handle public keys and encryption, hence these applications must be loaded for the SSL application to work. In an embedded environment this means they must be started with @@ -123,14 +123,14 @@ new client connections. If the maximum number of sessions is reached, the current cache entries will be invalidated regardless of their remaining lifetime. Defaults to - 1000.

+ 1000. Recommended ssl-8.2.1 or later for this option to work as intended.

]]>

Limits the growth of the servers session cache, that is how many client sessions are cached by the server. If the maximum number of sessions is reached, the current cache entries will be invalidated regardless of their remaining - lifetime. Defaults to 1000.

+ lifetime. Defaults to 1000. Recommended ssl-8.2.1 or later for this option to work as intended.

]]> @@ -145,9 +145,8 @@ ]]>

Introduced in ssl-8.0.2. Disables the PEM-cache. - The PEM cache has proven to be a bottleneck, until the - implementation has been improved this can be used as - a workaround. Defaults to false. + Can be used as a workaround for the PEM-cache bottlneck + before ssl-8.1.1. Defaults to false.

-- cgit v1.2.3 From f4901ebdeb3556897f309348ad5571abd3cb9421 Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Fri, 8 Dec 2017 15:17:41 +0100 Subject: dtls: Add DTLS handling to utility functions --- lib/ssl/doc/src/ssl.xml | 53 +++++++++++++++++++++++++++++++++------------ lib/ssl/doc/src/ssl_app.xml | 13 ++++++++--- 2 files changed, 49 insertions(+), 17 deletions(-) (limited to 'lib/ssl/doc/src') diff --git a/lib/ssl/doc/src/ssl.xml b/lib/ssl/doc/src/ssl.xml index ebef8bd69a..80b639155b 100644 --- a/lib/ssl/doc/src/ssl.xml +++ b/lib/ssl/doc/src/ssl.xml @@ -104,7 +104,7 @@ corresponding to inet:setopts/2, inet:getopts/2, inet:peername/1, inet:sockname/1, and inet:port/1. The callback gen_tcp is treated specially and calls inet - directly.

For DTLS this feature must be considered exprimental. + directly. For DTLS this feature must be considered exprimental.

CallbackModule =

atom()

@@ -140,10 +140,16 @@ sslsocket() =

opaque()

- - protocol() = + + protocol_versions() = +

ssl_tls_protocol() | dtls_protocol()

+ + ssl_tls_protocol() =

sslv3 | tlsv1 | 'tlsv1.1' | 'tlsv1.2'

+ dtls_protocol() = +

'dtlsv1' | 'dtlsv1.2'

+ ciphers() =

= [ciphersuite()] | string()

According to old API.

@@ -459,10 +465,10 @@ marker="public_key:public_key#pkix_path_validation-3">public_key:pkix_path_valid marker="public_key:public_key#pkix_path_validation-3">public_key:pkix_path_validation/3 with the selected CA as trusted anchor and the rest of the chain.

- {versions, [protocol()]} + {versions, [protocol_versions()]}

TLS protocol versions supported by started clients and servers. This option overrides the application environment option - protocol_version. If the environment option is not set, it defaults + protocol_version and dtls_protocol_version. If the environment option is not set, it defaults to all versions, except SSL-3.0, supported by the SSL application. See also ssl(6).

@@ -835,6 +841,7 @@ fun(srp, Username :: string(), UserState :: term()) -> cipher_suites() -> cipher_suites(Type) -> ciphers() + cipher_suites(Type, protocol_version()) -> ciphers() Returns a list of supported cipher suites. Type = erlang | openssl | all @@ -846,13 +853,14 @@ fun(srp, Username :: string(), UserState :: term()) -> all available cipher suites. The cipher suites not present in cipher_suites(erlang) but included in cipher_suites(all) are not used unless explicitly configured - by the user.

+ by the user. If the version option is not specified, the highest supported + TLS version will be used to determine the supported cipher suites

eccs() -> - eccs(protocol()) -> [named_curve()] + eccs(protocol_version()) -> [named_curve()] Returns a list of supported ECCs.

Returns a list of supported ECCs. eccs() @@ -860,7 +868,7 @@ fun(srp, Username :: string(), UserState :: term()) -> supported protocols and then deduplicating the output.

- + clear_pem_cache() -> ok Clears the pem cache @@ -917,7 +925,7 @@ fun(srp, Username :: string(), UserState :: term()) -> public_key:pkix_verify_hostname/2 will be performed in addition to the usual x509-path validation checks. If the check fails the error {bad_cert, hostname_check_failed} will be propagated to the path validation fun verify_fun, where it is possible to do customized - checks by using the full possibilitis of the public_key:pkix_verify_hostname/2 API. + checks by using the full possibilities of the public_key:pkix_verify_hostname/3 API. When the option server_name_indication is provided, its value (the DNS name) will be used as ReferenceID to public_key:pkix_verify_hostname/2. @@ -1335,7 +1343,8 @@ fun(srp, Username :: string(), UserState :: term()) -> Returns version information relevant for the SSL application. - versions_info() = {app_vsn, string()} | {supported | available, [protocol()] + versions_info() = {app_vsn, string()} | {supported | available, [ssl_tls_protocol()]} | + {supported_dtls | available_dtls, [dtls_protocol()]}

Returns version information relevant for the SSL @@ -1345,19 +1354,35 @@ fun(srp, Username :: string(), UserState :: term()) -> The application version of the SSL application. supported - SSL/TLS/DTLS versions supported by default. + SSL/TLS versions supported by default. Overridden by a version option on connect/[2,3,4], listen/2, and ssl_accept/[1,2,3]. - For the negotiated SSL/TLS/DTLS version, see ssl:connection_information/1 . - + + supported_dtls + DTLS versions supported by default. + Overridden by a version option on + connect/[2,3,4], + listen/2, and ssl_accept/[1,2,3]. + For the negotiated DTLS version, see ssl:connection_information/1 + . + available - All SSL/TLS/DTLS versions supported by the SSL application. + All SSL/TLS versions supported by the SSL application. TLS 1.2 requires sufficient support from the Crypto application. + + available_dtls + All DTLS versions supported by the SSL application. + DTLS 1.2 requires sufficient support from the Crypto + application. + diff --git a/lib/ssl/doc/src/ssl_app.xml b/lib/ssl/doc/src/ssl_app.xml index e79b79a434..fb395f8ffa 100644 --- a/lib/ssl/doc/src/ssl_app.xml +++ b/lib/ssl/doc/src/ssl_app.xml @@ -35,7 +35,7 @@

- The ssl application is an implementation of the SSL/TLS protocol in Erlang. + The ssl application is an implementation of the SSL/TLS/DTLS protocol in Erlang.

Supported SSL/TLS/DTLS-versions are SSL-3.0, TLS-1.0, @@ -94,13 +94,20 @@

erl -ssl protocol_version "['tlsv1.2', 'tlsv1.1']"

- protocol_version = ssl:protocol()]]> + protocol_version = ssl:ssl_tls_protocol()]]>

Protocol supported by started clients and servers. If this option is not set, it defaults to all - protocols currently supported by the SSL application. + TLS protocols currently supported by the SSL application. This option can be overridden by the version option to ssl:connect/[2,3] and ssl:listen/2.

+ dtls_protocol_version = ssl:dtls_protocol()]]> +

Protocol supported by started clients and + servers. If this option is not set, it defaults to all + DTLS protocols currently supported by the SSL application. + This option can be overridden by the version option + to ssl:connect/[2,3] and ssl:listen/2.

+ ]]>

Maximum lifetime of the session data in seconds. Defaults to 24 hours which is the maximum recommended lifetime by RFC 5246. However -- cgit v1.2.3 From 6a38adea390ff4c04103037a5fbd9044c6da12ad Mon Sep 17 00:00:00 2001 From: Ingela Anderton Andin Date: Thu, 25 Jan 2018 17:31:36 +0100 Subject: ssl: Fix typo --- lib/ssl/doc/src/ssl_app.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/ssl/doc/src') diff --git a/lib/ssl/doc/src/ssl_app.xml b/lib/ssl/doc/src/ssl_app.xml index fb395f8ffa..6d88df386f 100644 --- a/lib/ssl/doc/src/ssl_app.xml +++ b/lib/ssl/doc/src/ssl_app.xml @@ -152,7 +152,7 @@ ]]>

Introduced in ssl-8.0.2. Disables the PEM-cache. - Can be used as a workaround for the PEM-cache bottlneck + Can be used as a workaround for the PEM-cache bottleneck before ssl-8.1.1. Defaults to false.

-- cgit v1.2.3