sdamm / asio_dtls

A DTLS implementation using the ASIO library
51 stars 11 forks source link
asio asio-dtls boost-asio c-plus-plus datagram dtls encryption

DTLS support for ASIO using C++11

Introduction

ASIO::DTLS is an extension to ASIO(think-async.com). It provides encryption for Datagram based transports. The encryption is based on DTLS(rfc6347) using the OpenSSL(openssl.org) libraries.

ASIO::DTLS offers dtls_listen functionality which can be used to prevent certain DOS attacks against the Server side (see https://tools.ietf.org/html/rfc4347#section-4.2.1).

Differences between Datagram and Stream based Communication

There are three main differences from a programmer's standpoint between the Stream based and Datagram based Communication approaches:

DTLS offers encryption for Datagram based communication and must therefore allow Datagrams to be lost or received in wrong order. It provides the same Datagram semantics, so lost Datagrams will not be resend and out of order Datagrams are still out of order after decryption.

With Stream based protocols the connection establishment does validate (indirectly) that the other end is listening on the sender endpoint. Which as a side effect reduces the possibilities for spoofing attacks, which might be used for Denial-Of-Service/amplifier attacks against DTLS servers (see rfc6347 4.2.1 for details).

Differences between asio::ssl::stream and asio_dtls

To account for the Datagram semantic several changes had to be made:

Dependencies

Usage with Boost

Define ASIO_DTLS_USE_BOOST to use the Boost version. The Boost version uses the boost namespaces. So asio::ssl::dtls::context becomes boost::asio::ssl::dtls::context.

Work in Progress

This library is not finished and parts of the Code are copies from Files of ASIO. The structure and some of the files might still change.