GetMetadata Method
GetMetadata(Byte)
Get information about the specified slot.
public PivMetadata GetMetadata(byte slotNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | slotNumber | The slot for which the information is requested. |
Returns
A new instance of a PivMetadata
object containing information
about the given slot.
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The slot specified is not valid for getting metadata. |
System.InvalidOperationException | The YubiKey queried does not support metadata, or the operation could not be completed because of some error such as unreliable connection. |
Remarks
This feature is available only on YubiKeys 5.3 and later. If you call this method on an earlier YubiKey, it will throw an exception. A good idea is to verify that the version number is valid before calling.
IEnumerable<IYubiKeyDevice> list = YubiKey.FindByTransport(Transport.UsbSmartCard);
IYubiKeyDevice yubiKey = list.First();
using (var pivSession = new PivSession(yubiKey))
{
if (yubiKey.FirmwareVersion >= new FirmwareVersion(5, 3, 0))
{
PivMetadata metadataSlot9A =
pivSession.GetMetadata(PivSlot.Authentication);
}
}
See the User's Manual entry on getting metadata for specific information about what information is returned. Different slots return different sets of data. That page also lists the valid slots for which metadata is available.