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/using_ssl.xml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'lib/ssl/doc/src/using_ssl.xml') 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