Class VerifyUvResponse
The response to biometric verification.
public sealed class VerifyUvResponse : PivResponse, IYubiKeyResponseWithData<ReadOnlyMemory<byte>>, IYubiKeyResponse
- Inheritance
-
objectVerifyUvResponse
- Implements
- Inherited Members
Remarks
This is the partner Response class to VerifyUvCommand.
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 biometric authentication succeeded. GetData returns the temporary pin if requested. |
AuthenticationRequired | The biometric authentication failed. GetData returns null. AttemptsRemaining returns the number of retries remaining. If the number of retries is 0, the biometric authentication is blocked and the client should authenticate with the PIV PIN via VerifyPinCommand. |
Example:
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
var command = new VerifyUvCommand(false, false);
VerifyUvResponse response = connection.SendCommand(command);
if (response.Status == ResponseStatus.AuthenticationRequired)
{
int retryCount = response.AttemptsRemaining;
/* report the retry count */
}
else if (response.Status != ResponseStatus.Success)
{
/* handle error */
}
Constructors
VerifyUvResponse(ResponseApdu, bool)
Constructs a VerifyUvResponse based on a ResponseApdu received from the YubiKey.
public VerifyUvResponse(ResponseApdu responseApdu, bool requestTemporaryPin)
Parameters
responseApdu
ResponseApduThe object containing the response APDU
returned by the YubiKey.requestTemporaryPin
boolTrue means that a temporary PIN was requested.
Properties
AttemptsRemaining
Indicates how many biometric match retries are left (biometric match retry counter) until a biometric verification is blocked.
public int? AttemptsRemaining { get; }
Property Value
- int?
Remarks
The value is returned only if a authentication failed. To get remaining biometric attempts when not performing authentication, use AttemptsRemaining.
StatusCodeMap
Retrieves the details describing the processing state.
protected override YubiKeyResponse.ResponseStatusPair StatusCodeMap { get; }
Property Value
- YubiKeyResponse.ResponseStatusPair
The ResponseStatus and a descriptive message, as a YubiKeyResponse.ResponseStatusPair.
Remarks
Implementers of subtypes can override this member to change or add mappings.
Methods
GetData()
Gets the temporary PIN if requested.
public ReadOnlyMemory<byte> GetData()
Returns
- ReadOnlyMemory<byte>
null
if the PIN verifies, or the number of retries remaining if the PIN does not verify.
Remarks
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 biometric authentication succeeded. If requested, GetData returns the temporary PIN. |
AuthenticationRequired | The biometric authentication did not succeed. AttemptsRemaining contains number of of retries remaining. If the number of retries is 0 the biometric authentication is blocked and the client should use PIN authentication (VerifyPinCommand). |
Exceptions
- InvalidOperationException
Thrown if Status is not Success or AuthenticationRequired.