By Admin on Monday, 19 September 2022
Category: All

DTLS over UDP on Server and Client Components

​From sgcWebSockets 2022.8.0 DTLS over UDP is supported by Server and Client UDP components. This means that now you can send encrypted messages using UDP (like WebSocket or HTTP protocol that work over TLS).

From Wikipedia: Datagram Transport Layer Security (DTLS) is a communications protocol providing security to datagram-based applications by allowing them to communicate in a way designed[1][2] to prevent eavesdropping, tampering, or message forgery. The DTLS protocol is based on the stream-oriented Transport Layer Security (TLS) protocol and is intended to provide similar security guarantees.

Configuration 

​The configuration is very similar to other components. There is a new property called DTLSOptions where you can configure the DTLS options like file certificate, private key, certificate verification... To enabled DTLS just set the DTLS property to True before the server starts or before send a message from a client to server.

The certificate must be in PEM format, so if the certificate has a different format, first convert to PEM.

DTLS requires openSSL 1.1+ so the default Indy version that comes with  Rad Studio currently doesn't support it. Only sgcWebSockets Enterprise version supports DTLS (because this version comes with a custom indy version that supports openSSL 1.1 and 3.0).

Server 

Client 

Demo

Find below a link to a DTLS over UDP demo that shows how it works on windows using the sgcWebSockets library.

Related Posts