Class UdpDatagram
Provides a session's UDP datagram: a version byte, the session's ID (8 bytes), the sequence number (8) and the tag (16), then the payload, sealed with AES-GCM under the session's key, with the session's ID and the sequence number as its associated data.
public static class UdpDatagram
- Inheritance
-
UdpDatagram
- Inherited Members
Remarks
The version byte is written as 0 and not read: it is not in the associated data, so it must go in there before it may mean anything.
Fields
HeaderLength
The length of a datagram's header, before its payload: 33 bytes.
public const int HeaderLength = 33
Field Value
MinLegacyProtocolVersion
The first protocol of the legacy scheme, 11: a session below it has no UDP.
public const int MinLegacyProtocolVersion = 11
Field Value
MinProtocolVersion
The first protocol of this scheme, 14, with the server's own nonces and the freshness mark: a client takes no UDP from a server below it, and a server seals a session below it the legacy way.
public const int MinProtocolVersion = 14
Field Value
Methods
ReadSessionId(ReadOnlySpan<byte>)
Reads a datagram's session ID, which is not sealed.
public static ulong ReadSessionId(ReadOnlySpan<byte> datagram)
Parameters
datagramReadOnlySpan<byte>The datagram.
Returns
- ulong
The session's ID.
Exceptions
- ArgumentOutOfRangeException
datagramis shorter than 9 bytes.