Class ConfigCommand
The ConfigCommand is the class for
authenticatorConfig
. This command has a number of subcommands,
each of which is represented by its own class. You will likely never use
this class directly, but it does contain code shared by all the
subcommands.
public class ConfigCommand : IYubiKeyCommand<ConfigResponse>
- Inheritance
-
objectConfigCommand
- Implements
Remarks
The authenticatorConfig (0x0D)
FIDO2 command can be thought of as
a "meta" command. That is, it provides the structure and mechanism for
performing a number of subcommands. These subcommands are:
- enableEnterpriseAttestation (0x01)
- toggleAlwaysUv (0x02)
- setMinPINLength (0x03)
- vendorPrototype (0xFF)
Since the SDK does not have the concept of a subcommand natively, these are all exposed as their own separate commands.
See the user manual entry on Authenticator Config for a much more in depth guide to working with the config commands. For more information on a particular subcommand, see the API reference documentation for that command class.
All of the subcommands return a success or failure response code.
Constructors
ConfigCommand()
This constructor will throw NotImplementedException
. It is the
default constructor explicitly defined. We don't want it to be used.
It is made protected
rather than private
because there
are subclasses.
protected ConfigCommand()
ConfigCommand(int)
Constructs a new instance of ConfigCommand.
public ConfigCommand(int subCommand)
Parameters
subCommand
intThe byte representing the subcommand to execute.
ConfigCommand(int, byte[]?, ReadOnlyMemory<byte>, PinUvAuthProtocolBase)
Constructs a new instance of ConfigCommand.
public ConfigCommand(int subCommand, byte[]? subCommandParams, ReadOnlyMemory<byte> pinUvAuthToken, PinUvAuthProtocolBase authProtocol)
Parameters
subCommand
intThe byte representing the subcommand to execute.
subCommandParams
byte[]The parameters needed in order to execute the subcommand. Not all subcommands have parameters, so this can be null.
pinUvAuthToken
ReadOnlyMemory<byte>The PIN/UV Auth Token built from the PIN. This is the encrypted token key.
authProtocol
PinUvAuthProtocolBaseThe Auth Protocol used to build the Auth Token.
Remarks
Note that if the command does not need the pinUvAuthToken
and
authProtocol
, use the constructor that takes only the
subCommand
.
Properties
Application
Gets the YubiKeyApplication (e.g. PIV, OATH, etc.) to which this command applies.
public YubiKeyApplication Application { get; }
Property Value
- YubiKeyApplication
YubiKeyApplication.Otp, YubiKeyApplication.Piv, etc.
PinUvAuthParam
The output of calling authenticate on the PIN/UV protocol specific to a particular subcommand.
public ReadOnlyMemory<byte>? PinUvAuthParam { get; set; }
Property Value
- ReadOnlyMemory<byte>?
Remarks
See the User's Manual entry on PIN protocols for a much more in depth guide to working with PINs within FIDO2.
See also the User's Manual entry on
AuthenticatorConfig
for more information on building the PIN/UV Auth Param
specific to the AuthenticatorConfig commands.
PinUvAuthProtocol
The PIN/UV protocol version chosen by the platform.
public PinUvAuthProtocol? PinUvAuthProtocol { get; set; }
Property Value
Remarks
A PIN/UV protocol must be used when performing some of the AuthenticatorConfig operations. The specified protocol must be one of the protocols that are supported by the YubiKey. This can be determined by issuing the AuthenticatorGetInfo command.
SubCommand
The Config subcommand to issue to the YubiKey.
public int SubCommand { get; set; }
Property Value
- int
Remarks
This is a mandatory parameter, and must be one of the following values:
- enableEnterpriseAttestation (0x01)
- toggleAlwaysUv (0x02)
- setMinPINLength (0x03)
- vendorPrototype (0xFF)
Alternatively - you can use one of the command classes exposed by the SDK that represents the subcommand itself. Such a method is recommended as these command classes will only expose the parameters that are relevant to that subcommand.
SubCommandParameters
The encoded params for the specified subcommand. If a subcommand has no parameters, this will be null.
public ReadOnlyMemory<byte>? SubCommandParameters { get; }
Property Value
- ReadOnlyMemory<byte>?
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 ConfigResponse CreateResponseForApdu(ResponseApdu responseApdu)
Parameters
responseApdu
ResponseApduThe ResponseApdu returned by the YubiKey.
Returns
- ConfigResponse
The implementation of IYubiKeyResponse that parses and presents ths response APDU.