generateCookie

fnubyte[] generateCookie(const(ubyte)[] serverSecret, DatagramEndpoint clientAddr, const(ubyte)[] clientRandom)

Generates a stateless cookie for DTLS HelloVerifyRequest.

The cookie is computed as: HMAC-SHA256(serverSecret, clientAddress.toBytes() || clientRandom)

This binds the cookie to the client's address and the ClientHello random, making it unforgeable without the server secret.

Parameters

serverSecretThe server's secret key for cookie generation.
clientAddrThe client's network address.
clientRandomThe 32-byte ClientHello random value.

Returns

The cookie bytes (typically 32 bytes for HMAC-SHA256).