Show / Hide Table of Contents

GetSerialNumberCommand Class

Namespace: Yubico.YubiKey.Piv.Commands Assembly: Yubico.YubiKey.dll

Get the YubiKey's serial number.

C#
public sealed class GetSerialNumberCommand : IYubiKeyCommand<GetSerialNumberResponse>
Inheritance object GetSerialNumberCommand
Implements
IYubiKeyCommand<GetSerialNumberResponse>

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.

In this article
Back to top Generated by DocFX