PivSession Constructor
PivSession(IYubiKeyDevice)
Create an instance of PivSession
, the object that represents
the PIV application on the YubiKey.
public PivSession(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 |
Remarks
Because this class implements IDisposable
, use the using
keyword. For example,
IYubiKeyDevice yubiKeyToUse = SelectYubiKey();
using (var piv = new PivSession(yubiKeyToUse))
{
/* Perform PIV operations. */
}
PivSession(IYubiKeyDevice, StaticKeys)
Create an instance of PivSession
, the object that represents
the PIV application on the YubiKey. The communication between the SDK
and the YubiKey will be protected by SCP03.
public PivSession(IYubiKeyDevice yubiKey, StaticKeys scp03Keys)
Parameters
Type | Name | Description |
---|---|---|
IYubiKeyDevice | yubiKey | The object that represents the actual YubiKey which will perform the operations. |
StaticKeys | scp03Keys | The SCP03 key set to use in establishing the connection. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The |
System.InvalidOperationException | This exception is thrown when unable to determine the management key type. |
Remarks
See the User's Manual entry on SCP03 for more information on this communication protocol.
Because this class implements IDisposable
, use the using
keyword. For example,
IYubiKeyDevice yubiKeyToUse = SelectYubiKey();
// Assume you have some method that obtains the appropriate SCP03
// key set.
using StaticKeys scp03Keys = CollectScp03Keys();
using (var piv = new PivSession(yubiKeyToUse, scp03Keys))
{
/* Perform PIV operations. */
}