Show / Hide Table of Contents

GetMetadataCommand Class

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

Get information about the key in a specified slot.

C#
public sealed class GetMetadataCommand : IYubiKeyCommand<GetMetadataResponse>
Inheritance object GetMetadataCommand
Implements
IYubiKeyCommand<GetMetadataResponse>

Remarks

The Get Metadata command is available on YubiKey version 5.3 and later.

The partner Response class is GetMetadataResponse.

See the User's Manual entry on getting metadata for specific information about what information is returned. Different slots return different sets of data.

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

Name Description
GetMetadataCommand()

Initializes a new instance of the GetMetadataCommand class.

GetMetadataCommand(byte)

Initializes a new instance of the GetMetadataCommand class. This command takes the slot number as input.

Properties

Name Description
Application

Gets the YubiKeyApplication to which this command belongs. For this command it's PIV.

SlotNumber

The slot for which the metadate is requested.

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