Table of Contents

Class GetMetadataResponse

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

The response to the get metadata command, containing information about a particular key.

public sealed class GetMetadataResponse : PivResponse, IYubiKeyResponseWithData<PivMetadata>, IYubiKeyResponse
Inheritance
object
GetMetadataResponse
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 ResponseApdu

The object containing the response APDU
returned by the YubiKey.

slotNumber byte

The 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.

Exceptions

InvalidOperationException

Thrown when Status is not Success.