WithScp03 Method
WithScp03(YubiKeyDevice, StaticKeys)
Use this method to make sure any Smart Card communication is
conducted using SCP03. If the input device
is already set for
SCP03, this method will verify that the input staticKeys
are
the same as those used to build the device
and if they are,
simply return the input device.
public static IYubiKeyDevice WithScp03(this YubiKeyDevice device, StaticKeys scp03Keys)
Parameters
Type | Name | Description |
---|---|---|
YubiKeyDevice | device | The underlying YubiKey device for which SCP03 communications are to be used. |
StaticKeys | scp03Keys | The symmetric key set to use. This call will copy the keys (not just a reference). |
Returns
A wrapped YubiKeyDevice that uses SCP03.
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The |
System.NotSupportedException | The YubiKey device does not have an available smart card interface or it does not support SCP03. |
Remarks
This method of making an SCP03 connection is deprecated. See the User's Manual entry on SCP03 for information on how best to make an SCP03 connection..
The YubiKey itself is represented by an instance of YubiKeyDevice. After choosing the YubiKey to use, you can specify that Smart Card communications be conduced using SCP03. The key set you supply will be the keys used to encrypt and authenticate/verify. That key set must already be loaded onto the YubiKey.
For example, use SCP03 in a PivSession.
if (!YubiKeyDevice.TryGetYubiKey(serialNumber, out IYubiKeyDevice yubiKeyDevice))
{
// error, can't find YubiKey
}
yubiKeyDevice = (YubiKeyDevice)yubiKeyDevice.WithScp03(scp03Keys);
using (var pivSession = new pivSession(yubiKeyDevice))
{
. . .
}