Class GetSerialNumberResponse
The response to the get serial number command, containing the YubiKey's serial number.
public sealed class GetSerialNumberResponse : PivResponse, IYubiKeyResponseWithData<int>, IYubiKeyResponse
- Inheritance
-
objectGetSerialNumberResponse
- Implements
- Inherited Members
Remarks
This is the partner Response class to GetSerialNumberCommand.
The data returned is an int
.
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
GetSerialNumberResponse(ResponseApdu)
Constructs a GetSerialNumberResponse based on a ResponseApdu received from the YubiKey.
public GetSerialNumberResponse(ResponseApdu responseApdu)
Parameters
responseApdu
ResponseApduThe object containing the response APDU
returned by the YubiKey.
Methods
GetData()
Gets the serial number from the YubiKey response.
public int GetData()
Returns
- int
The data in the response APDU, presented as an int.
Exceptions
- InvalidOperationException
- MalformedYubiKeyResponseException
Thrown when the
ResponseApdu.Data
does not meet the expectations of the parser.