DTLS PSK test
DTLS PSK test — server and client in one process, exchange data and verify payloads.
Single-process test: runs DTLS server and client, exchanges application data both ways and verifies payloads. No required parameters; uses built-in PSK.
Single-process test: a DTLS server and client (PSK) exchange application data over in-memory UDP and verify that the payloads received match what was sent.
What it does
- Creates server and client DTLS contexts (DTLS 1.2, pre-shared key).
- Simulates UDP with two buffers (server↔client, client↔server).
- Performs a minimal handshake (ClientHello, ServerHello).
- Server → Client: sends
MSG_SERVER_TO_CLIENT; client receives and verifies. - Client → Server: sends
MSG_CLIENT_TO_SERVER; server receives and verifies. - Exits 0 if all checks pass, 1 otherwise.
Build
From the project root (with DTLS enabled, default):
cmake -B build -DBUILD_DTLS=ON .
cmake --build build
Then run:
./build/applications/dtls_psk_test/dtls_psk_test # Unix
build\applications\dtls_psk_test\Debug\dtls_psk_test.exe # Windows VS
Usage
No arguments. Output is pass/fail per step and a final exit code (0 = success, 1 = failure).
Requirements
BUILD_DTLS=ONwhen building the NoxTLS library (default innoxtls-lib/tls).
Examples
dtls_psk_test