Class GetMetadataResponse
The response to the get metadata command, containing information about a particular key.
public sealed class GetMetadataResponse : PivResponse, IYubiKeyResponseWithData<PivMetadata>, IYubiKeyResponse
- Inheritance
-
objectGetMetadataResponse
- Implements
- Inherited Members
Remarks
The Get Metadata command is available on YubiKey version 5.3 and later.
This is the partner Response class to GetMetadataCommand.
The data returned is a PivMetadata.
Example:
IYubiKeyConnection connection = key.Connect(YubiKeyApplication.Piv);
GetMetadataCommand metadataCommand = new GetMetadataCommand(0x9A);
GetMetadataResponse metadataResponse = connection.SendCommand(metadataCommand);
if (metadataResponse.Status == ResponseStatus.Success)
{
PivMetadata keyData = metadataResponse.GetData();
}
Constructors
GetMetadataResponse(ResponseApdu, byte)
Constructs a GetMetadataResponse based on a ResponseApdu received from the YubiKey.
public GetMetadataResponse(ResponseApdu responseApdu, byte slotNumber)
Parameters
responseApdu
ResponseApduThe object containing the response APDU
returned by the YubiKey.slotNumber
byteThe slot for which the metadata references.
Properties
SlotNumber
The slot for which the metadata is returned.
public byte SlotNumber { get; }
Property Value
- byte
The slot number, see PivSlot
Methods
GetData()
Gets the metadata from the YubiKey response.
public PivMetadata GetData()
Returns
- PivMetadata
The data in the response APDU, presented as a PivMetadata object.
Remarks
If the Status is ResponseStatus.NoData
, the slot is empty and
this method will throw an exception. Hence, it is a good idea to check
Status
before calling this method.