Skip to main content
Version: 0.3.0

DTLS 1.2

DTLS 1.2 uses the TLS 1.2 handshake and cipher suite implementation over the DTLS datagram record layer. Header: noxtls_tls12.h with shared DTLS declarations in noxtls_dtls_common.h.

Use noxtls_dtls12_context_init to initialize a tls12_context_t for datagram transport. Configure MTU, retransmission, cookies, replay handling, and anti-amplification settings with the shared DTLS API.

Features​

AreaSupport
Record layerDTLS 1.2 13-byte record header with epoch and 48-bit sequence number
HandshakeTLS 1.2 handshake over datagrams
FragmentationHandshake fragmentation and reassembly
Loss recoveryFlight buffering and retransmission timer configuration
Replay protectionSliding replay window
DoS mitigationHelloVerifyRequest cookie generation and verification
TransportCallback-based datagram I/O using the TLS common callback API

RFC 6347 conformance (0.3.0). The handshake transcript uses 12-byte DTLS handshake headers, Finished is a DTLS handshake message, the MAC and AEAD sequence number include the epoch, read and write epochs are separate, every record in a datagram is processed, records from another epoch and replays are discarded silently, and retransmissions use new record sequence numbers. DTLS 1.2 interoperates with OpenSSL; earlier NoxTLS builds used a NoxTLS-only wire format and cannot complete a handshake with 0.3.0. Not supported: several handshake messages in one record, cookies longer than 32 bytes, and max_fragment_length applied to DTLS fragmentation.

API​

noxtls_dtls12_context_init​

noxtls_return_t noxtls_dtls12_context_init(tls12_context_t *ctx, tls_role_t role);

Initialize a TLS 1.2 context for DTLS 1.2 operation.

Returns: noxtls_return_t.

Handshake and Data​

After initialization, use the TLS 1.2 handshake and data functions on the same context:

Typical Setup​

tls12_context_t ctx;

noxtls_dtls12_context_init(&ctx, TLS_ROLE_CLIENT);
noxtls_tls_set_io_callbacks(&ctx.base.base, send_cb, recv_cb, user_data);
noxtls_dtls_set_mtu(&ctx.base, 1200);
dtls_set_retransmit(&ctx.base, 1000, 2000, 5);

noxtls_tls12_connect(&ctx);

See DTLS common API for record, fragmentation, cookie, and replay helper functions.