Table of Contents

Class OathChallengeResponseBaseCommand

Namespace
Yubico.YubiKey.Oath.Commands
Assembly
Yubico.YubiKey.dll

Provides helper methods that are used to calculate challenge-response for the commands: SetPassword, Validate, CalculateCredential, CalculateAllCredentials.

public abstract class OathChallengeResponseBaseCommand
Inheritance
object
OathChallengeResponseBaseCommand
Derived

Methods

CalculateResponse(ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)

Calculates HMAC using SHA1 as a hash function.

protected static byte[] CalculateResponse(ReadOnlyMemory<byte> secret, ReadOnlyMemory<byte> message)

Parameters

secret ReadOnlyMemory<byte>
message ReadOnlyMemory<byte>

Returns

byte[]

HMAC result.

CalculateSecret(ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)

Passes a user-supplied UTF-8 encoded password through 1000 rounds of PBKDF2 with the salt value (the deviceID returned in SelectResponse).

protected static byte[] CalculateSecret(ReadOnlyMemory<byte> password, ReadOnlyMemory<byte> salt)

Parameters

password ReadOnlyMemory<byte>
salt ReadOnlyMemory<byte>

Returns

byte[]

16 bytes secret for authentication.

GenerateRandomChallenge()

Generates random 8 bytes that can be used as challenge for authentication.

protected static byte[] GenerateRandomChallenge()

Returns

byte[]

Random 8 bytes.

GenerateTotpChallenge(CredentialPeriod?)

Generates 8 bytes challenge that can be used for TOTP credential calculation.

protected static byte[] GenerateTotpChallenge(CredentialPeriod? period)

Parameters

period CredentialPeriod?

Returns

byte[]

8 bytes challenge.