Class ApplicationSession
Abstract base class for sessions with a YubiKey. This class is used
to wrap the IYubiKeyConnection
and provide a way of
interacting with the connection that is more convenient for most
users.
public abstract class ApplicationSession
- Inheritance
-
objectApplicationSession
- Derived
Constructors
ApplicationSession(ILogger, IYubiKeyDevice, YubiKeyApplication, ScpKeyParameters?)
Initializes a new instance of the ApplicationSession class with logging, YubiKey device, application, and optional SCP key parameters.
protected ApplicationSession(ILogger logger, IYubiKeyDevice device, YubiKeyApplication application, ScpKeyParameters? keyParameters)
Parameters
logger
ILoggerThe logger instance used for logging information.
device
IYubiKeyDeviceThe YubiKey device to establish a session with.
application
YubiKeyApplicationThe specific YubiKey application to connect to.
keyParameters
ScpKeyParametersThe optional parameters for an SCP connection.
Exceptions
- ArgumentNullException
Thrown when the
device
is null.- InvalidOperationException
Thrown when the Yubikey does not support the requested SCP connection.
Properties
Application
The specific YubiKey application to connect to.
public YubiKeyApplication Application { get; }
Property Value
Connection
The object that represents the connection to the YubiKey. Most applications will ignore this, but it can be used to call Commands directly.
public IYubiKeyConnection Connection { get; protected set; }
Property Value
KeyParameters
Gets the parameters used for establishing a Secure Channel Protocol (SCP) connection.
public ScpKeyParameters? KeyParameters { get; }
Property Value
Logger
The logger instance used for logging information.
protected ILogger Logger { get; }
Property Value
YubiKey
The YubiKey device to establish a session with.
protected IYubiKeyDevice YubiKey { get; }
Property Value
Methods
Dispose()
When the ApplicationSession object goes out of scope, this method is called. It will close the session. The most important function of closing a session is to "un-authenticate" the management key and "un-verify" the PIN.
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
GetConnection(IYubiKeyDevice, YubiKeyApplication, ScpKeyParameters?)
protected IYubiKeyConnection GetConnection(IYubiKeyDevice yubiKey, YubiKeyApplication application, ScpKeyParameters? keyParameters)
Parameters
yubiKey
IYubiKeyDeviceapplication
YubiKeyApplicationkeyParameters
ScpKeyParameters