Class SetPasswordCommand
Configures Authentication. If length 0 is sent, authentication is removed. The key to be set is expected to be a user-supplied UTF-8 encoded password passed through 1000 rounds of PBKDF2 with the ID from SelectOathResponse used as salt. 16 bytes of that are used. When configuring authentication you are required to send an 8 byte challenge and one authentication-response with that key, in order to confirm that the application and the host software can calculate the same response for that key.
public class SetPasswordCommand : OathChallengeResponseBaseCommand, IYubiKeyCommand<SetPasswordResponse>
- Inheritance
-
objectSetPasswordCommand
- Implements
- Inherited Members
Constructors
SetPasswordCommand(ReadOnlyMemory<byte>, OathApplicationData)
Constructs an instance of the SetPasswordCommand class.
public SetPasswordCommand(ReadOnlyMemory<byte> password, OathApplicationData oathData)
Parameters
password
ReadOnlyMemory<byte>The user-supplied password to validate.
oathData
OathApplicationDataAn implementation of
OathApplicationData
.
Properties
Application
Gets the YubiKeyApplication to which this command belongs.
public YubiKeyApplication Application { get; }
Property Value
- YubiKeyApplication
YubiKeyApplication.Oath
OathData
Gets the OATH application information.
public OathApplicationData OathData { get; }
Property Value
Password
Gets the password.
public ReadOnlyMemory<byte> Password { get; }
Property Value
- ReadOnlyMemory<byte>
A user-supplied password to validate.
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 SetPasswordResponse CreateResponseForApdu(ResponseApdu responseApdu)
Parameters
responseApdu
ResponseApduThe ResponseApdu returned by the YubiKey.
Returns
- SetPasswordResponse
The implementation of IYubiKeyResponse that parses and presents ths response APDU.