Show / Hide Table of Contents

PivSession Constructor

PivSession(IYubiKeyDevice, StaticKeys)

C#
[Obsolete("Use new constructor with ScpKeyParamaters")]
public PivSession(IYubiKeyDevice yubiKey, StaticKeys scp03Keys)

Parameters

Type Name Description
IYubiKeyDevice yubiKey
StaticKeys scp03Keys

PivSession(IYubiKeyDevice, ScpKeyParameters?)

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.

C#
public PivSession(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

The SCP key parameters, if any, to use in establishing the SCP connection.

Exceptions

Type Condition
ArgumentNullException

The yubiKey argument is null.

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