Struct ServerHandshake
Broadcast sent by the server to complete the handshake, containing the server's X25519 public key for ECDH key agreement and the negotiated protocol version.
public struct ServerHandshake : IBroadcast
- Implements
-
IBroadcast
- Inherited Members
Remarks
PublicKey and Cookie are mutually exclusive:
- A cookie challenge has
PublicKey == nullandCookie != null. Use IsChallenge to test for this. - The final handshake response has
PublicKey != nullandCookie == null. Use IsHandshakeResponse to test for this.
Consumers MUST use the helper properties instead of null-checking directly, so that any future wire-format changes remain isolated to this struct.
Fields
AgreedVersion
Negotiated protocol version agreed during handshake. Both sides use this version in AAD and HKDF labels for all subsequent messages.
public ushort AgreedVersion
Field Value
Cookie
Stateless HMAC challenge cookie. The client must echo this in a subsequent ClientHandshake to prove it can receive replies from the server. Null when this message contains the final handshake response. Use IsChallenge or IsHandshakeResponse to discriminate.
public byte[] Cookie
Field Value
- byte[]
PublicKey
Server's ephemeral X25519 public key (32 bytes). Null when this message is a cookie challenge (proof-of-reachability). Use IsChallenge or IsHandshakeResponse to discriminate.
public byte[] PublicKey
Field Value
- byte[]
Properties
IsChallenge
Gets whether this message is a cookie challenge (proof-of-reachability). Mutually exclusive with IsHandshakeResponse.
public bool IsChallenge { get; }
Property Value
IsHandshakeResponse
Gets whether this message is the final handshake response (ECDH key exchange). Mutually exclusive with IsChallenge.
public bool IsHandshakeResponse { get; }