ResetRetryResponse Class
Namespace: Yubico.YubiKey.Piv.Commands Assembly: Yubico.YubiKey.dllThe response to resetting the PIN, using the PUK (PIN Unblocking Key).
public sealed class ResetRetryResponse : PivResponse, IYubiKeyResponseWithData<Nullable<int>>, IYubiKeyResponse
Remarks
This is the partner Response class to ResetRetryCommand.
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 was successfully reset. GetData returns
null . |
AuthenticationRequired | The PUK did not verify. GetData returns the number of retries remaining. If the number of retries is 0, the PUK is blocked. |
Example:
using System.Security.Cryptography;
/* This example assumes the application has a method to collect a
* PIN/PUK.
*/
byte[] puk;
byte[] newPin;
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
puk = CollectPuk();
newPin = CollectNewPin();
var resetRetryCommand = new ResetRetryCommand(puk, newPin);
ResetRetryResponse resetRetryResponse = connection.SendCommand(resetRetryCommand);
if (resetRetryResponse.Status != ResponseStatus.Success)
{
if (resetRetryResponse.Status == ResponseStatus.AuthenticationRequired)
{
int retryCount = resetRetryResponse.GetData();
/* report the retry count */
}
else
{
// Handle error
}
}
CryptographicOperations.ZeroMemory(puk);
CryptographicOperations.ZeroMemory(newPin);
Constructors
Name | Description |
---|---|
ResetRetryResponse(ResponseApdu) | Constructs a ResetRetryResponse based on a ResponseApdu received from the YubiKey. |
Properties
Name | Description |
---|---|
StatusCodeMap |
Methods
Name | Description |
---|---|
GetData() | Gets the number of PUK retries remaining, if applicable. |