YubiHsmAuthSession Constructor
YubiHsmAuthSession(IYubiKeyDevice)
Create an instance of YubiHsmAuthSession
class, the object
that represents the YubiHSM Auth application on the YubiKey.
C#
public YubiHsmAuthSession(IYubiKeyDevice yubiKey)
Parameters
Type | Name | Description |
---|---|---|
IYubiKeyDevice | yubiKey | The object that represents the actual YubiKey which will perform the operations. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The |
System.NotSupportedException | Failed to connect to the YubiHSM Auth application. |
Remarks
The YubiHSM Auth application is available in YubiKey firmware version 5.4.3 and later. You can check if the application is available by using HasFeature(IYubiKeyDevice, YubiKeyFeature), and see if it's enabled over the desired interface by checking EnabledUsbCapabilities or EnabledNfcCapabilities.
Because this class implements IDisposable
, use the
using
keyword. For example,
IYubiKeyDevice yubiKeyToUse = SelectYubiKey();
using (var yubiHsmAuth = new YubiHsmAuthSession(yubiKeyToUse))
{
/* Perform YubiHSM Auth operations. */
}