Table of Contents

Class SetLegacyDeviceConfigBase

Namespace
Yubico.YubiKey.Management.Commands
Assembly
Yubico.YubiKey.dll

Writes configuration settings that are supported by YubiKeys prior to firmware version 5.

public class SetLegacyDeviceConfigBase
Inheritance
object
SetLegacyDeviceConfigBase
Derived

Remarks

This is the only configuration operation available to YubiKeys prior to firmware version 5. These YubiKeys have limited configuration settings, and all of them must be set at the same time.

Constructors

SetLegacyDeviceConfigBase(SetLegacyDeviceConfigBase)

Copy constructor.

protected SetLegacyDeviceConfigBase(SetLegacyDeviceConfigBase baseCommand)

Parameters

baseCommand SetLegacyDeviceConfigBase

The SetLegacyDeviceConfig base command object to copy from.

Remarks

Intended to be used by child classes to make it easier to convert into a different application-specific command.

SetLegacyDeviceConfigBase(YubiKeyCapabilities, byte, bool, int)

Initializes a new instance of the SetLegacyDeviceConfigBase class.

protected SetLegacyDeviceConfigBase(YubiKeyCapabilities yubiKeyInterfaces, byte challengeResponseTimeout, bool touchEjectEnabled, int autoEjectTimeout)

Parameters

yubiKeyInterfaces YubiKeyCapabilities

Value for YubiKeyInterfaces.

challengeResponseTimeout byte

Value for ChallengeResponseTimeout.

touchEjectEnabled bool

Value for TouchEjectEnabled.

autoEjectTimeout int

Value for AutoEjectTimeout.

Remarks

This command sends all configuration settings every time. Therefore all values must be provided every time.

Exceptions

ArgumentException

Thrown if yubiKeyInterfaces contains unsupported flags.

ArgumentOutOfRangeException

Thrown when autoEjectTimeout is out of the valid range.

Properties

AutoEjectTimeout

The CCID auto-eject timeout (in seconds). This field is only meaningful if touch eject is enabled (see TouchEjectEnabled).

public int AutoEjectTimeout { get; set; }

Property Value

int

Remarks

When setting, the value must be in the range ushort.MinValue through ushort.MaxValue. A value of 0 means that the timeout is disabled (the smart card will not be ejected automatically).

Exceptions

ArgumentOutOfRangeException

Thrown by the setter when the value is out of the valid range.

ChallengeResponseTimeout

The period of time (in seconds) after which the OTP challenge-response command should timeout.

public byte ChallengeResponseTimeout { get; set; }

Property Value

byte

TouchEjectEnabled

The CCID touch-eject feature is enabled.

public bool TouchEjectEnabled { get; set; }

Property Value

bool

Remarks

For the CCID connection, the YubiKey behaves as a smart card reader and smart card. When this flag is disabled, the smart card is always present in the smart card reader. When enabled, the smart card will be ejected by default, and the user is required to touch the YubiKey to insert the smart card. For this to take effect, all YubiKeyCapabilities which do not depend on the CCID connection (such as Fido2, FidoU2f, and Otp) must be disabled.

To automatically eject the smart card following a touch, see AutoEjectTimeout.

YubiKeyInterfaces

The interfaces of the YubiKey that should be enabled over USB.

public YubiKeyCapabilities YubiKeyInterfaces { get; set; }

Property Value

YubiKeyCapabilities

Remarks

This is an indirect means of controlling which YubiKey applications are available to the end user.

There must be at least one enabled interface. Only the following flags are allowed:

Exceptions

ArgumentException

Thrown by the setter if the value contains unsupported flags.

Methods

ContainsOnlyValidInterfaceFlags(YubiKeyCapabilities)

public static bool ContainsOnlyValidInterfaceFlags(YubiKeyCapabilities yubiKeyInterfaces)

Parameters

yubiKeyInterfaces YubiKeyCapabilities

Returns

bool

GetDataForApdu()

Formats the data to be sent to the YubiKey.

protected byte[] GetDataForApdu()

Returns

byte[]

A formatted byte array.