VerifyPinResponse Class
Namespace: Yubico.YubiKey.Piv.Commands Assembly: Yubico.YubiKey.dllThe response to verifying the PIN.
public sealed class VerifyPinResponse : PivResponse, IYubiKeyResponseWithData<Nullable<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.
Status | Description |
---|---|
Success | The PIN verified. GetData returns null . |
AuthenticationRequired | The 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 |
Methods
Name | Description |
---|---|
GetData() | Gets the number of PIN retries remaining, if applicable. |