Class VersionResponse
The response to the get version command, containing the YubiKey's firmware version.
public sealed class VersionResponse : PivResponse, IYubiKeyResponseWithData<FirmwareVersion>, IYubiKeyResponse
- Inheritance
-
objectVersionResponse
- Implements
- Inherited Members
Remarks
This is the partner Response class to VersionCommand.
The data returned is FirmwareVersion.
Example:
IList<IYubiKeyDevice> keys = YubiKey.GetList();
foreach (IYubiKeyDevice key in keys)
{
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
VersionCommand versionCmd = new VersionCommand();
VersionResponse versionRsp = connection.SendCommand(versionCmd);
if (versionNum.Status != ResponseStatus.Success)
{
// Handle error
}
FirmwareVersion versionNum = versionRsp.GetData();
}
Constructors
VersionResponse(ResponseApdu)
Constructs a VersionResponse based on a ResponseApdu received from the YubiKey.
public VersionResponse(ResponseApdu responseApdu)
Parameters
responseApdu
ResponseApduThe object containing the response APDU
returned by the YubiKey.
Methods
GetData()
Gets the version from the YubiKey response.
public FirmwareVersion GetData()
Returns
- FirmwareVersion
The data in the response APDU, presented as a FirmwareVersion object.
Exceptions
- MalformedYubiKeyResponseException
Thrown when the
ResponseApdu.Data
does not meet the expectations of the parser.- InvalidOperationException