Noble Connect
Add relays and punchthrough to Mirror or UNet
NobleConnect.Stun.LongTermCredentials Class Reference

Credentials used for authenticating messages More...

Inherits NobleConnect.Stun.ShortTermCredentials.

Public Member Functions

 LongTermCredentials (string username, string password)
 
override void CalculateHashKey ()
 The hashKey is an MD5 encoding of a string made up of the username, realm, and password, separated by colons More...
 
override bool IsValid ()
 
override bool ValidateMessageCredentials (Message m)
 
override void AddCredentialsToAttributes (List< Attribute > attributes)
 
void SetRealmAndNonce (AttributeString realm, AttributeString nonce)
 
- Public Member Functions inherited from NobleConnect.Stun.ShortTermCredentials
 ShortTermCredentials (string username, string password)
 
override void CalculateHashKey ()
 The hashKey is a UTF-8 encoding of the password More...
 
override bool IsValid ()
 
override bool ValidateMessageCredentials (Message m)
 
override bool ValidateMessageIntegrity (Message m, byte[] rawBytes)
 
override void AddCredentialsToAttributes (List< Attribute > attributes)
 
- Public Member Functions inherited from NobleConnect.Stun.Credentials
virtual bool ValidateMessage (Message m, byte[] rawBytes)
 
virtual AttributeRaw GenerateMessageIntegrityAttribute (MessageHeader header, List< Attribute > attributes)
 
byte[] ComputeHash (BufferView bytesSoFar)
 Use HMACSHA1 along with the hash key and buffer data to generate the message integrity hash More...
 
byte[] ComputeHash (byte[] messageBytes, int offset=0, int length=-1)
 Use HMACSHA1 along with the hash key and buffer data to generate the message integrity hash More...
 

Public Attributes

AttributeString realm
 The realm is returned by the Stun server and echoed back by the clients More...
 
AttributeString nonce
 The nonce is returned by the Stun server and echoed back by the clients More...
 
- Public Attributes inherited from NobleConnect.Stun.ShortTermCredentials
string password
 The password is set via configuratio on the Stun server and clients More...
 
- Public Attributes inherited from NobleConnect.Stun.Credentials
AttributeString username
 The username is set via configuration on the Stun server and clients More...
 

Additional Inherited Members

- Protected Attributes inherited from NobleConnect.Stun.Credentials
byte[] hashKey
 This is used as the key to an HMACSHA1 hash of the message contents that is sent as the Value of a MessageIntegrity attribute. More...
 

Detailed Description

Credentials used for authenticating messages

See RFC 5389 Section 10.2 for details about the long-term authentication process

Constructor & Destructor Documentation

◆ LongTermCredentials()

NobleConnect.Stun.LongTermCredentials.LongTermCredentials ( string  username,
string  password 
)

Member Function Documentation

◆ AddCredentialsToAttributes()

override void NobleConnect.Stun.LongTermCredentials.AddCredentialsToAttributes ( List< Attribute attributes)
virtual

Reimplemented from NobleConnect.Stun.Credentials.

◆ CalculateHashKey()

override void NobleConnect.Stun.LongTermCredentials.CalculateHashKey ( )
virtual

The hashKey is an MD5 encoding of a string made up of the username, realm, and password, separated by colons

This is used as the key to an HMACSHA1 hash of the message contents that is sent as the Value of a MessageIntegrity attribute. See RFC 5389 Section 15.4 for details.

Implements NobleConnect.Stun.Credentials.

◆ IsValid()

override bool NobleConnect.Stun.LongTermCredentials.IsValid ( )
virtual

◆ SetRealmAndNonce()

void NobleConnect.Stun.LongTermCredentials.SetRealmAndNonce ( AttributeString  realm,
AttributeString  nonce 
)

◆ ValidateMessageCredentials()

override bool NobleConnect.Stun.LongTermCredentials.ValidateMessageCredentials ( Message  m)
virtual

Member Data Documentation

◆ nonce

AttributeString NobleConnect.Stun.LongTermCredentials.nonce

The nonce is returned by the Stun server and echoed back by the clients

Eventually the nonce will expire and the server will reject the request and send a new nonce.

◆ realm

AttributeString NobleConnect.Stun.LongTermCredentials.realm

The realm is returned by the Stun server and echoed back by the clients