Erlang -- ssl

Secure Socket Layer

Reference Manual

Version 9.2

- User's Guide
- Reference Manual
- Release Notes
- PDF
- Top

- Expand All
- Contract All

### Table of Contents

- ssl (App)
- ssl
  - Top of manual page
  - append_cipher_suites/2
  - cipher_suites/0
  - cipher_suites/1
  - cipher_suites/2
  - clear_pem_cache/0
  - close/1
  - close/2
  - connect/2
  - connect/3
  - connect/3
  - connect/4
  - connection_information/1
  - connection_information/2
  - controlling_process/2
  - eccs/0
  - eccs/1
  - filter_cipher_suites/2
  - format_error/1
  - getopts/2
  - getstat/1
  - getstat/2
  - handshake/1
  - handshake/2
  - handshake/2
  - handshake/3
  - handshake_cancel/1
  - handshake_continue/2
  - handshake_continue/3
  - listen/2
  - negotiated_protocol/1
  - peercert/1
  - peername/1
  - prepend_cipher_suites/2
  - prf/5
  - recv/2
  - recv/3
  - renegotiate/1
  - send/2
  - setopts/2
  - shutdown/2
  - sockname/1
  - ssl_accept/1
  - ssl_accept/2
  - ssl_accept/2
  - ssl_accept/3
  - start/0
  - start/1
  - stop/0
  - suite_to_str/1
  - transport_accept/1
  - transport_accept/2
  - versions/0
- ssl_crl_cache
  - Top of manual page
  - delete/1
  - insert/1
  - insert/2
- ssl_crl_cache_api
  - Top of manual page
  - fresh_crl/2
  - lookup/3
  - lookup/2
  - select/2
- ssl_session_cache_api
  - Top of manual page
  - delete/2
  - foldl/3
  - init/1
  - lookup/2
  - select_session/2
  - size/1
  - terminate/1
  - update/3

# ssl_session_cache_api

### Module

ssl_session_cache_api

### Module Summary

TLS session cache API

### Since

Module ssl_session_cache_api was introduced in OTP R14B.

### Description

Defines the API for the TLS session cache so that the data storage scheme can be replaced by defining a new callback module implementing this API.

### Data Types

session_cache_ref() = any()
session_cache_key() = {partial_key(), ssl:session_id()}

A key to an entry in the session cache.

partial_key()

The opaque part of the key. Does not need to be handled by the callback.

session()

The session data that is stored for each session.

### Exports

delete(Cache, Key) -> _ | OTP R14B

### Types

Cache = session_cache_ref()
Key = session_cache_key()

Deletes a cache entry. Is only called from the cache handling process.

foldl(Fun, Acc0, Cache) -> Acc | OTP R14B

### Types

Fun = fun()
Acc0 = Acc = term()
Cache = session_cache_ref()

Calls Fun(Elem, AccIn) on successive elements of the cache, starting with AccIn == Acc0. Fun/2 must return a new accumulator, which is passed to the next call. The function returns the final value of the accumulator. Acc0 is returned if the cache is empty.

init(Args) -> Cache | OTP 18.0

### Types

Cache = session_cache_ref()
Args = proplists:proplist()

Includes property {role, client | server}. Currently this is the only predefined property, there can also be user-defined properties. See also application environment variable session_cb_init_args.

Performs possible initializations of the cache and returns a reference to it that is used as parameter to the other API functions. Is called by the cache handling processes init function, hence putting the same requirements on it as a normal process init function. This function is called twice when starting the SSL application, once with the role client and once with the role server, as the SSL application must be prepared to take on both roles.

lookup(Cache, Key) -> Entry | OTP R14B

### Types

Cache = session_cache_ref()
Key = session_cache_key()
Session = session() | undefined

Looks up a cache entry. Is to be callable from any process.

select_session(Cache, PartialKey) -> [Session] | OTP R14B

### Types

Cache = session_cache_ref()
PartialKey = partial_key()
Session = session()

Selects sessions that can be reused. Is to be callable from any process.

size(Cache) -> integer() | OTP 19.3

### Types

Cache = session_cache_ref()

Returns the number of sessions in the cache. If size exceeds the maximum number of sessions, the current cache entries will be invalidated regardless of their remaining lifetime. Is to be callable from any process.

terminate(Cache) -> _ | OTP R14B

### Types

Cache = session_cache_ref()
As returned by init/0

Takes care of possible cleanup that is needed when the cache handling process terminates.

update(Cache, Key, Session) -> _ | OTP R14B

### Types

Cache = session_cache_ref()
Key = session_cache_key()
Session = session()

Caches a new session or updates an already cached one. Is only called from the cache handling process.