Struct CryptoHelper.SessionKeys
- Namespace
- FishMMO.Auth.Implementation
- Assembly
- FishMMO-AuthShared.dll
Container for derived session keys and prefixes.
public readonly struct CryptoHelper.SessionKeys : IDisposable
- Implements
- Inherited Members
Remarks
Mutability: The byte[] fields are mutable references. Callers must not share or alias them, and must zeroize via ZeroMemory(byte[]) when no longer needed.
IDisposable usage: Implement using var keys = DeriveSessionKeys(…);
to ensure Dispose() zeroes all key material when the scope exits.
Because this is a readonly struct, the compiler calls Dispose()
directly on the variable without boxing.
Constructors
SessionKeys(byte[], byte[], byte[], byte[])
public SessionKeys(byte[] clientToServerKey, byte[] serverToClientKey, byte[] clientPrefix, byte[] serverPrefix)
Parameters
Fields
ClientPrefix
public readonly byte[] ClientPrefix
Field Value
- byte[]
ClientToServerKey
public readonly byte[] ClientToServerKey
Field Value
- byte[]
ServerPrefix
public readonly byte[] ServerPrefix
Field Value
- byte[]
ServerToClientKey
public readonly byte[] ServerToClientKey
Field Value
- byte[]
Methods
Dispose()
Zeroes all key material. Equivalent to ZeroAll().
Enables using var keys = …; for deterministic cleanup.
public void Dispose()
ZeroAll()
Zeroes all key material referenced by this instance.
public void ZeroAll()
Remarks
Ownership: SessionKeys is a transient container whose fields are
typically copied into long-lived connection state after derivation. Calling
ZeroAll() only zeroes the arrays referenced by THIS struct — it does not
affect copies held by ConnectionEncryptionData or other consumers.
Callers must manage key lifetime at the connection level.