Show / Hide Table of Contents

CalculateCredential Method

CalculateCredential(Credential, ResponseFormat)

Gets an OTP (One-Time Password) value for the specific credential on the YubiKey.

C#
public Code CalculateCredential(Credential credential, ResponseFormat responseFormat = ResponseFormat.Truncated)

Parameters

Type Name Description
Credential credential

The Credential on the YubiKey to calculate.

ResponseFormat responseFormat

Full or truncated ResponseFormat to receive back. The default value is Truncated.

Returns

Code

The Code for the requested credential.

Exceptions

Type Condition
ArgumentNullException

Provided credential is null.

InvalidOperationException

There is no KeyCollector loaded if the authentication is required or the CalculateCredentialCommand failed.

SecurityException

Unable to verify password either because KeyCollector was canceled by the user or an incorrect password was provided if authentication is required.

CalculateCredential(string?, string, CredentialType, CredentialPeriod, ResponseFormat)

Gets an OTP code for the specific credential.

C#
public Code CalculateCredential(string? issuer, string account, CredentialType type, CredentialPeriod period, ResponseFormat responseFormat = ResponseFormat.Truncated)

Parameters

Type Name Description
string issuer

The issuer is an optional string indicating the provider or service.

string account

The account name that usually is the user's email address.

CredentialType type

Indicates the CredentialType of the credential as either HOTP or TOTP.

CredentialPeriod period

Indicates the CredentialPeriod of the credential in seconds for TOTP code. It can only be 15, 30, or 60 seconds. For HOTP should be set to zero (Undefined).

ResponseFormat responseFormat

Full or truncated ResponseFormat to receive back. The default value is Truncated.

Returns

Code

The Code for the requested credential.

Exceptions

Type Condition
InvalidOperationException

There is no KeyCollector loaded if the authentication is required, the CalculateCredentialCommand failed, or the provided account, type, or period is invalid.

SecurityException

Unable to verify password either because KeyCollector was canceled by the user or an incorrect password was provided if authentication is required.

In this article
Back to top Generated by DocFX