Table of Contents

Class ClientFirstMessage

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

Represents the first message sent by the client in the SCRAM authentication process.

public class ClientFirstMessage
Inheritance
ClientFirstMessage
Inherited Members

Constructors

ClientFirstMessage(string, string, ChannelBindingStatus, TlsVersion)

Initializes a new instance of the ClientFirstMessage class.

public ClientFirstMessage(string username, string nonce, ChannelBindingStatus bindingStatus = ChannelBindingStatus.NotSupported, TlsVersion tlsVersion = TlsVersion.TlsUnique)

Parameters

username string

Username of the user to authenticate.

nonce string

String value of the client nonce.

bindingStatus ChannelBindingStatus

Binding status of the message.

tlsVersion TlsVersion

What version of TLS binding to use.

Properties

BareMessage

Gets the bare version of the client message, concatenating the username and nonce attributes as formatted strings for use in the SCRAM authentication process.

public string BareMessage { get; }

Property Value

string

Gs2Header

Gets the GS2 header attribute of the message, which represents the channel binding status as part of the SCRAM (Salted Challenge Response Authentication Mechanism) protocol.

public Gs2Attribute Gs2Header { get; }

Property Value

Gs2Attribute

Message

Gets the complete SCRAM client-first-message string. This property combines various SCRAM attributes, including GS2 header, username, and nonce, to form the full authentication message.

public string Message { get; }

Property Value

string

Nonce

Gets the nonce attribute used in the client's first message during the SCRAM authentication process. The nonce is a unique, randomly generated value used to ensure the integrity and security of the authentication exchange.

public NonceAttribute? Nonce { get; }

Property Value

NonceAttribute

Username

Gets the username attribute of the client, used in the SCRAM authentication process. This property represents the user's identifier with specific formatting and escaping rules.

public UserAttribute? Username { get; }

Property Value

UserAttribute

Methods

Parse(string)

Parses the provided message into an instance of ClientFirstMessage.

[UsedImplicitly]
public static ClientFirstMessage Parse(string message)

Parameters

message string

Message to parse.

Returns

ClientFirstMessage

An instance of ClientFirstMessage created from the provided message.

TryParse(string, out ClientFirstMessage)

Attempts to parse the provided message into an instance of ClientFirstMessage.

[UsedImplicitly]
public static bool TryParse(string message, out ClientFirstMessage result)

Parameters

message string

The SCRAM message to be parsed.

result ClientFirstMessage

The resulting ClientFirstMessage if parsing succeeds; otherwise null.

Returns

bool

true if the message is successfully parsed; otherwise false.

Operators

implicit operator ClientFirstMessage(byte[])

Implicitly convert a byte array into a ClientFirstMessage.

public static implicit operator ClientFirstMessage(byte[] message)

Parameters

message byte[]

Byte array to convert.

Returns

ClientFirstMessage

Parsed instance of ClientFirstMessage.

implicit operator ClientFirstMessage(string)

Implicitly convert a string into a ClientFirstMessage.

public static implicit operator ClientFirstMessage(string message)

Parameters

message string

String to convert.

Returns

ClientFirstMessage

Parsed instance of ClientFirstMessage.

implicit operator byte[](ClientFirstMessage)

Implicitly converts the ClientFirstMessage into a byte array.

public static implicit operator byte[](ClientFirstMessage message)

Parameters

message ClientFirstMessage

Message to convert to byte array.

Returns

byte[]

Byte array of the message.