Class VerifyTemporaryPinCommand
Verify the PIV Bio temporary PIN.
public sealed class VerifyTemporaryPinCommand : IYubiKeyCommand<VerifyTemporaryPinResponse>
- Inheritance
-
objectVerifyTemporaryPinCommand
- Implements
Remarks
The partner Response class is VerifyTemporaryPinResponse.
When using biometric verification, clients can request a temporary PIN by calling VerifyUvCommand with requestTemporaryPin=true.
Example:
/* This example assumes the application has a method to collect a PIN.
*/
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
/* request temporary PIN */
var verifyUvCommand = new VerifyUvCommand(true, false);
/* a biometric verification will be performed */
var verifyUvResponse = connection.SendCommand(verifyUvCommand);
if (verifyUvResponse.Status == ResponseStatus.Success)
{
var temporaryPin = verifyUvResponse.GetData();
/* using temporary PIN will not request biometric verification */
var verifyTemporaryPinCommand = new VerifyTemporaryPin(temporaryPin);
var verifyResponse = connection.SendCommand(verifyTemporaryPinCommand);
if (verifyResponse == ResponseStatus.Success)
{
/* session is authenticated */
}
}
Constructors
VerifyTemporaryPinCommand(ReadOnlyMemory<byte>)
Initializes a new instance of the VerifyTemporaryPinCommand class which will use the given temporary PIN.
public VerifyTemporaryPinCommand(ReadOnlyMemory<byte> temporaryPin)
Parameters
temporaryPin
ReadOnlyMemory<byte>The temporary Pin.
Remarks
In order to verify a temporary PIN, the caller must supply the temporary PIN.
In this class, the temporary PIN is supplied as ReadOnlyMemory<byte>
.
It is possible to pass a byte[]
, because it will be automatically cast.
This class will copy references to the temporary PIN (not the values. This
means that you can overwrite the temporary PIN in your byte array only after
this class is done with it. It will no longer need the temporary PIN after
calling connection.SendCommand
.
A temporary PIN is 16 bytes long.
Exceptions
- ArgumentException
The PIN is an invalid length.
Properties
Application
Gets the YubiKeyApplication to which this command belongs. For this command it's PIV.
public YubiKeyApplication Application { get; }
Property Value
- YubiKeyApplication
YubiKeyApplication.Piv
Methods
CreateCommandApdu()
Creates a well-formed CommandApdu to send to the YubiKey.
public CommandApdu CreateCommandApdu()
Returns
- CommandApdu
A valid CommandApdu that is ready to be sent to the YubiKey, or passed along to additional encoders for further processing.
Remarks
This method will first perform validation on all of the parameters and data provided to it. The CommandAPDU it creates should contain all of the data payload for the command, even if it exceeds 65,535 bytes as specified by the ISO 7816-4 specification. The APDU will be properly chained by the device connection prior to being sent to the YubiKey, and the responses will collapsed into a single result.
CreateResponseForApdu(ResponseApdu)
Creates the corresponding IYubiKeyResponse implementation for the current command.
public VerifyTemporaryPinResponse CreateResponseForApdu(ResponseApdu responseApdu)
Parameters
responseApdu
ResponseApduThe ResponseApdu returned by the YubiKey.
Returns
- VerifyTemporaryPinResponse
The implementation of IYubiKeyResponse that parses and presents ths response APDU.