Class MessageIntegrityAttribute
The MESSAGE-INTEGRITY attribute contains an HMAC-SHA1 [RFC2104] of the STUN message. The MESSAGE-INTEGRITY attribute can be present in any STUN message type. Since it uses the SHA1 hash, the HMAC will be 20 bytes. The text used as input to HMAC is the STUN message, including the header, up to and including the attribute preceding the MESSAGE-INTEGRITY attribute. With the exception of the FINGERPRINT attribute, which appears after MESSAGE-INTEGRITY, agents MUST ignore all other attributes that follow MESSAGE-INTEGRITY.
Inherited Members
Namespace: FM.LiveSwitch.Stun
Assembly: FM.LiveSwitch.dll
Syntax
public class MessageIntegrityAttribute : Attribute
Constructors
MessageIntegrityAttribute(Byte[])
Initializes a new instance of the MessageIntegrityAttribute class.
Declaration
public MessageIntegrityAttribute(byte[] keyBuffer)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | keyBuffer | The key as a buffer. |
Properties
MessageBuffer
Gets or sets the message buffer.
Declaration
public DataBuffer MessageBuffer { get; set; }
Property Value
Type | Description |
---|---|
DataBuffer |
TypeValue
Gets the type value.
Declaration
public override int TypeValue { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Overrides
Methods
GetValueLength()
Gets the length of the attribute value.
Declaration
protected override int GetValueLength()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
IsValid(Byte[])
After creating a message-integrity attribute using the byte array representation, this method determines whether the supplied key is valid.
Declaration
public bool IsValid(byte[] keyBuffer)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | keyBuffer | The key as a buffer. |
Returns
Type | Description |
---|---|
System.Boolean |
|
ReadValueFrom(DataBuffer, Int32, Int32, DataBuffer)
Initializes a new instance of the MessageIntegrityAttribute class.
Declaration
public static MessageIntegrityAttribute ReadValueFrom(DataBuffer buffer, int offset, int length, DataBuffer messageBuffer)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | buffer | The buffer. |
System.Int32 | offset | The offset. |
System.Int32 | length | The length. |
DataBuffer | messageBuffer | The message buffer thus far. |
Returns
Type | Description |
---|---|
MessageIntegrityAttribute |
ToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A string that represents this instance. |
Overrides
WriteValueTo(DataBuffer, Int32)
Writes the attribute value to a data buffer.
Declaration
protected override void WriteValueTo(DataBuffer buffer, int offset)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | buffer | The buffer. |
System.Int32 | offset | The offset. |