Class ClientFirstMessage
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
usernamestringUsername of the user to authenticate.
noncestringString value of the client nonce.
bindingStatusChannelBindingStatusBinding status of the message.
tlsVersionTlsVersionWhat 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
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
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
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
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
Methods
Parse(string)
Parses the provided message into an instance of ClientFirstMessage.
[UsedImplicitly]
public static ClientFirstMessage Parse(string message)
Parameters
messagestringMessage 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
messagestringThe SCRAM message to be parsed.
resultClientFirstMessageThe 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
messagebyte[]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
messagestringString 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
messageClientFirstMessageMessage to convert to byte array.
Returns
- byte[]
Byte array of the message.