Class SmartCardDevice
Base class for Yubico.Core.Devices.SmartCard.DesktopSmartCardDevice.
public abstract class SmartCardDevice : ISmartCardDevice, IDevice
- Inheritance
-
objectSmartCardDevice
- Implements
Constructors
SmartCardDevice(string, AnswerToReset?)
Constructs a SmartCardDevice with the specified properties.
protected SmartCardDevice(string path, AnswerToReset? atr)
Parameters
path
stringDevice path.
atr
AnswerToResetAnswerToReset properties.
Properties
Atr
The "answer to reset" (ATR) for the smart card.
public AnswerToReset? Atr { get; }
Property Value
Remarks
The ATR for a smart card can act as an identifier for the type of card that is inserted.
Kind
Gets the smart card's connection type.
public SmartCardConnectionKind Kind { get; }
Property Value
LastAccessed
The time when this device was last accessed.
public DateTime LastAccessed { get; protected set; }
Property Value
- DateTime
Remarks
Certain Yubico devices, such as the YubiKey, require a short delay before switching to and communicating with a different USB interface. This is called the reclaim timeout. The YubiKey SDK must keep track of the last interface to have been accessed and when in order to properly implement this delay.
ParentDeviceId
A unique identifier corresponding to the parent USB composite device, if available.
public string? ParentDeviceId { get; protected set; }
Property Value
- string
Remarks
Certain devices that this SDK works with, like the YubiKey, are presented to the operating system as a composite device. This means that, to the operating system, multiple devices may be detected even though you have only plugged in one physical device. OSes that do this still expose a single "composite" device in their device tree. This is the common parent across all of the sub-devices.
Keeping track of this information, if available, can greatly increase the SDK's performance when it attempts to reconstruct the single, composite device out of all of the sub-devices. This isn't always possible, however, as the OS services that we use to enumerate the sub-devices don't always provide much information about its parent device. macOS and Windows 7, for example, cannot provide parent information for smart card devices. In those cases, we'll have to make do and attempt to match these devices some other way.
Path
Gets the platform defined path to the device.
public string Path { get; }
Property Value
- string
Remarks
The exact meaning of this property may vary between operating systems and device types. The SDK treats this property as an opaque value and only uses it to check for uniqueness across device instances. It is strongly recommended that you do not take a dependency on the exact format or meaning of the value of this property.
Methods
Connect()
Establishes an active connection to the smart card for the transmittal of data.
public abstract ISmartCardConnection Connect()
Returns
- ISmartCardConnection
An already opened connection to the smart card reader.
Create(string, AnswerToReset?)
Creates a new smart card device object.
public static ISmartCardDevice Create(string readerName, AnswerToReset? atr)
Parameters
readerName
stringDevice reader name.
atr
AnswerToResetThe optional AnswerToReset identifier for the smart card device.
Returns
- ISmartCardDevice
A SmartCardDevice object.
GetSmartCardDevices()
Returns the set of smart card reader devices available to the system.
public static IReadOnlyList<ISmartCardDevice> GetSmartCardDevices()
Returns
- IReadOnlyList<ISmartCardDevice>
A read-only list of SmartCardDevice objects.
ToString()
public override string ToString()
Returns
- string