Show / Hide Table of Contents

Authenticate Method

Authenticate(byte[])

Returns the result of computing HMAC-SHA-256 on the given message using the AuthenticationKey. With protocol 1, the result is the first 16 bytes of the HMAC, and with protocol 2 it is the entire 32-byte result.

C#
public abstract byte[] Authenticate(byte[] message)

Parameters

Type Name Description
byte[] message

The data to be authenticated.

Returns

byte[]

A new byte array containing the authentication result.

Exceptions

Type Condition
ArgumentNullException

The message argument is null.

InvalidOperationException

The object has been created or initialized, but the Encapsulate(CoseKey) method has not been called.

Authenticate(byte[], byte[])

Returns the result of computing HMAC-SHA-256 on the given message using the provided keyData. With protocol 1, the result is the first 16 bytes of the HMAC, and with protocol 2 it is the entire 32-byte result.

C#
protected abstract byte[] Authenticate(byte[] keyData, byte[] message)

Parameters

Type Name Description
byte[] keyData

The key to use to authenticate.

byte[] message

The data to be authenticated.

Returns

byte[]

A new byte array containing the authentication result.

Exceptions

Type Condition
ArgumentNullException

The keyData or message argument is null.

In this article
Back to top Generated by DocFX