TlsAead.encryptWithSequence

ubyte[] encryptWithSequence(const(ubyte)[] plaintext, const(ubyte)[] aad, ulong recordSequence)

Encrypts a record using the nonce for an explicit record sequence number.

The nonce is the static IV XOR the 64-bit big-endian sequence number (left-padded to the IV length), per RFC 8446 §5.3 and RFC 9147 §4.2.2. The internal counter is not used or advanced; the caller supplies the wire sequence number, which makes the construction robust against datagram loss and reordering.

Parameters

plaintextThe data to encrypt.
aadAdditional authenticated data.
recordSequenceThe record's wire sequence number.

Returns

Ciphertext + tag.