Table of Contents

Class ClientFinalMessage

Namespace
Ubiety.Scram.Core.Messages
Assembly
Ubiety.Scram.Core.dll

Represents the final message sent from the client during the SCRAM (Salted Challenge Response Authentication Mechanism) authentication process.

public class ClientFinalMessage
Inheritance
ClientFinalMessage
Inherited Members

Constructors

ClientFinalMessage(ClientFirstMessage, ServerFirstMessage, string, Hash, byte[]?, int)

Initializes a new instance of the ClientFinalMessage class.

public ClientFinalMessage(ClientFirstMessage clientFirstMessage, ServerFirstMessage serverFirstMessage, string password, Hash hash, byte[]? token = null, int minimumIterations = 4096)

Parameters

clientFirstMessage ClientFirstMessage

First client message.

serverFirstMessage ServerFirstMessage

First server message.

password string

User password.

hash Hash

Hash to use when calculating proof.

token byte[]

Channel binding token. Required when the client first message declared Required, and must be omitted otherwise.

minimumIterations int

Smallest iteration count to accept from the server. Defaults to MinimumIterations; lower it only to interoperate with a legacy server that predates RFC 7677, and understand that doing so weakens the derivation.

Exceptions

ArgumentException

Thrown when the token does not match the channel binding status of clientFirstMessage, or when the server first message does not carry the nonce or iteration count the protocol requires.

Fields

MaximumIterations

The largest iteration count this library will derive a key for.

public const int MaximumIterations = 10000000

Field Value

int

Remarks

Well above anything a real deployment uses, and low enough that a server cannot stall the client indefinitely by asking for an absurd amount of work.

MinimumIterations

The smallest iteration count a server may ask for, as required by RFC 7677 section 4.

public const int MinimumIterations = 4096

Field Value

int

Remarks

The iteration count is chosen by the server, so a client that accepts whatever it is sent lets a hostile or compromised server weaken its own password derivation.

Properties

Channel

Gets the channel attribute used for encoding the GS2 (Generic Security Service) header in the SCRAM authentication process.

public ChannelAttribute Channel { get; }

Property Value

ChannelAttribute

Message

Gets the complete message for the client in the final stage of SCRAM authentication, including the channel binding, nonce, and optionally the client proof, formatted as a single string.

public string Message { get; }

Property Value

string

MessageWithoutProof

Gets the constructed client final message content excluding the proof value, which includes the channel binding information and the nonce.

public string MessageWithoutProof { get; }

Property Value

string

Nonce

Gets the nonce attribute used during the SCRAM (Salted Challenge Response Authentication Mechanism) process to ensure message uniqueness and mitigate replay attacks.

public NonceAttribute Nonce { get; }

Property Value

NonceAttribute

Proof

Gets the proof attribute, which represents the computed client proof used in the SCRAM authentication process.

public ClientProofAttribute? Proof { get; }

Property Value

ClientProofAttribute

ServerSignature

Gets the server signature as calculated with the proof.

public string ServerSignature { get; }

Property Value

string

Operators

implicit operator byte[](ClientFinalMessage)

Implicitly converts a ClientFinalMessage to its byte array representation using UTF-8 encoding.

public static implicit operator byte[](ClientFinalMessage message)

Parameters

message ClientFinalMessage

The client final message to convert.

Returns

byte[]

A byte array containing the UTF-8 encoded message.