Show / Hide Table of Contents

VerifyPinResponse Class

Namespace: Yubico.YubiKey.Piv.Commands Assembly: Yubico.YubiKey.dll

The response to verifying the PIN.

C#
public sealed class VerifyPinResponse : PivResponse, IYubiKeyResponseWithData<int?>, IYubiKeyResponse
Inheritance object YubiKeyResponse PivResponse VerifyPinResponse
Implements
IYubiKeyResponseWithData<int?>
IYubiKeyResponse

Remarks

This is the partner Response class to VerifyPinCommand.

To determine the result of the command, first look at the Status. If Status is not one of the following values then an error has occurred and GetData() will throw an exception.

StatusDescription
SuccessThe PIN verified. GetData returns null.
AuthenticationRequiredThe PIN did not verify. GetData returns the number of retries remaining. If the number of retries is 0, the PIN is blocked.

Example:

/* This example assumes the application has a method to collect a PIN.
 */
byte[] pin;

IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
pin = CollectPin();
var verifyPinCommand = new VerifyPinCommand(pin);
VerifyPinResponse verifyPinResponse = connection.SendCommand(verifyPinCommand);
if (resetRetryResponse.Status == ResponseStatus.AuthenticationRequired)
{
  int retryCount = resetRetryResponse.GetData();
  /* report the retry count */
}
else if (verifyPinResponse.Status != ResponseStatus.Success)
{
  // Handle error
}

CryptographicOperations.ZeroMemory(pin)

Constructors

Name Description
VerifyPinResponse(ResponseApdu)

Constructs a VerifyPinResponse based on a ResponseApdu received from the YubiKey.

Properties

Name Description
StatusCodeMap

Retrieves the details describing the processing state.

Methods

Name Description
GetData()

Gets the number of PIN retries remaining, if applicable.

In this article
Back to top Generated by DocFX