Show / Hide Table of Contents

YubiHsmAuthSession Constructor

YubiHsmAuthSession(IYubiKeyDevice, ScpKeyParameters?)

Create an instance of YubiHsmAuthSession class, the object that represents the YubiHSM Auth application on the YubiKey.

C#
public YubiHsmAuthSession(IYubiKeyDevice yubiKey, ScpKeyParameters? keyParameters = null)

Parameters

Type Name Description
IYubiKeyDevice yubiKey

The object that represents the actual YubiKey which will perform the operations.

ScpKeyParameters keyParameters

If supplied, the parameters used open the SCP connection.

Exceptions

Type Condition
ArgumentNullException

The yubiKey argument is null.

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. */
}
In this article
Back to top Generated by DocFX