GetSerialNumberCommand Class
Namespace: Yubico.YubiKey.Piv.Commands Assembly: Yubico.YubiKey.dllGet the YubiKey's serial number.
C#
public sealed class GetSerialNumberCommand : Object, IYubiKeyCommand<GetSerialNumberResponse>
Inheritance
System.Object
GetSerialNumberCommand
Implements
Remarks
The partner Response class is GetSerialNumberResponse.
Example:
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
SerialCommand serialCommand = new GetSerialNumberCommand();
GetSerialNumberResponse serialResponse = connection.SendCommand(serialCommand);
if (serialResponse.Status == ResponseStatus.Success)
{
int serialNum = serialResponse.GetData();
}
Constructors
Name | Description |
---|---|
GetSerialNumberCommand() | Initializes a new instance of the GetSerialNumberCommand class. This command has no input. |
Properties
Name | Description |
---|---|
Application | Gets the YubiKeyApplication to which this command belongs. For this command it's PIV. |
Methods
Name | Description |
---|---|
CreateCommandApdu() | Creates a well-formed CommandApdu to send to the YubiKey. |
CreateResponseForApdu(ResponseApdu) | Creates the corresponding IYubiKeyResponse implementation for the current command. |