Class AuthenticateCommand
Calls on the YubiKey to authenticate U2F data.
public sealed class AuthenticateCommand : U2fBufferCommand, IYubiKeyCommand<AuthenticateResponse>
- Inheritance
-
objectAuthenticateCommand
- Implements
- Inherited Members
Remarks
The partner Response class is AuthenticateResponse.
Constructors
AuthenticateCommand()
Creates an instance of the command.
public AuthenticateCommand()
Remarks
This constructor is provided for those developers who want to use the object initializer pattern.
Set the ClientDataHash
, ApplicationId
, KeyHandle
and ControlByte
properties before sending the command to the
YubiKey.
AuthenticateCommand(U2fAuthenticationType, ReadOnlyMemory<byte>, ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)
Creates an instance of the command with the given auth type, client data hash, app ID, and key handle.
public AuthenticateCommand(U2fAuthenticationType controlByte, ReadOnlyMemory<byte> applicationId, ReadOnlyMemory<byte> clientDataHash, ReadOnlyMemory<byte> keyHandle)
Parameters
controlByte
U2fAuthenticationTypeThe type of authentication to perform.
applicationId
ReadOnlyMemory<byte>The SHA256 hash of the Relying Party ID. It must be 32 bytes long. This is the hash of the origin data.
clientDataHash
ReadOnlyMemory<byte>The
clientDataHash
or "challenge" in the U2F (or CTAP2) specifications. It must be 32 bytes long.keyHandle
ReadOnlyMemory<byte>The key handle provided by the Relying Party.
Remarks
The controlByte
indicates what level of authentication to
perform. It is called "control byte" because the standard specifies a
control byte in the command's encoding.
The applicationId
and clientDataHash
are values
provided by the client.
The keyHandle
is the value provided by the relying party, it
was created by the YubiKey during registration and stored by the
relying party.
Properties
ControlByte
The authentication type that will be performed.
public U2fAuthenticationType ControlByte { get; set; }
Property Value
KeyHandle
The private key handle to be used to sign the challenge. This is the key handle returned by the YubiKey during registration.
public ReadOnlyMemory<byte> KeyHandle { get; set; }
Property Value
- ReadOnlyMemory<byte>
Methods
CreateResponseForApdu(ResponseApdu)
Creates the corresponding IYubiKeyResponse implementation for the current command.
public AuthenticateResponse CreateResponseForApdu(ResponseApdu responseApdu)
Parameters
responseApdu
ResponseApduThe ResponseApdu returned by the YubiKey.
Returns
- AuthenticateResponse
The implementation of IYubiKeyResponse that parses and presents ths response APDU.