19992018 Ericsson AB. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ssl ssl_app.sgml
ssl The ssl application provides secure communication over sockets.

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, 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. Interoperability with SSL-2.0 enabled clients dropped. (OTP 21) For security reasons SSL-3.0 is no longer supported by default, but can be configured. (OTP 19) For security reasons RSA key exchange cipher suites are no longer supported by default, but can be configured. (OTP 21) For security reasons DES cipher suites are no longer supported by default, but can be configured. (OTP 20) For security reasons 3DES cipher suites are no longer supported by default, but can be configured. (OTP 21) Renegotiation Indication Extension RFC 5746 is supported Ephemeral Diffie-Hellman cipher suites are supported, but not Diffie Hellman Certificates cipher suites. Elliptic Curve cipher suites are supported if the Crypto application supports it and named curves are used. Export cipher suites are not supported as the U.S. lifted its export restrictions in early 2000. IDEA cipher suites are not supported as they have become deprecated by the latest TLS specification so it is not motivated to implement them. Compression is not supported. CRL validation is supported. Policy certificate extensions are not supported. 'Server Name Indication' extension (RFC 6066) is supported. Application Layer Protocol Negotiation (ALPN) and its successor Next Protocol Negotiation (NPN) are supported. It is possible to use Pre-Shared Key (PSK) and Secure Remote Password (SRP) cipher suites, but they are not enabled by default.
DEPENDENCIES

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 application:start/[1,2] before the SSL application is started.

CONFIGURATION

The application environment configuration parameters in this section are defined for the SSL application. For more information about configuration parameters, see the application(3) manual page in Kernel.

The environment parameters can be set on the command line, for example:

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

protocol_version = ssl:ssl_tls_protocol()]]>

Protocol supported by started clients and servers. If this option is not set, it defaults to all 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 sessions may be invalidated earlier due to the maximum limitation of the session cache table.

]]>

Name of the session cache callback module that implements the ssl_session_cache_api behavior. Defaults to ssl_session_cache.

]]>

List of extra user-defined arguments to the init function in the session cache callback module. Defaults to [].

]]>

Limits the growth of the clients session cache, that is how many sessions towards servers that are cached to be used by 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. 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. Recommended ssl-8.2.1 or later for this option to work as intended.

]]>

Number of milliseconds between PEM cache validations. Defaults to 2 minutes.

ssl:clear_pem_cache/0
]]>

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

]]>

Number of milliseconds between sending of a fatal alert and closing the connection. Waiting a little while improves the peers chances to properly receiving the alert so it may shutdown gracefully. Defaults to 5000 milliseconds.

]]>

For TLS connections this value is used to handle the internal socket. As the implementation was changed from an active once to an active N behavior (N = 100), for performance reasons, this option exist for possible tweaking or restoring of the old behavior (internal_active_n = 1) in unforeseen scenarios. The option will not affect erlang distribution over TLS that will always run in active N mode. Added in ssl-9.1 (OTP-21.2).

ERROR LOGGER AND EVENT HANDLERS

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

SEE ALSO

application(3)