Show / Hide Table of Contents

SetLegacyDeviceConfiguration Method

SetLegacyDeviceConfiguration(YubiKeyCapabilities, byte, bool, int)

Manage configuration settings on YubiKeys prior to firmware version 5.

C#
public void SetLegacyDeviceConfiguration(YubiKeyCapabilities yubiKeyInterfaces, byte challengeResponseTimeout, bool touchEjectEnabled, int autoEjectTimeout)

Parameters

Type Name Description
YubiKeyCapabilities yubiKeyInterfaces

The desired set of USB interfaces to enable on the YubiKey. Any non-interface values are ignored. A set flag means that the related interface is enabled. Otherwise, the interface is disabled. At least one available USB interface must be enabled.

If touchEjectEnabled is true, then only the Ccid interface can be enabled.

byte challengeResponseTimeout

The length of the timeout in seconds. A value of 0 resets the timeout to its default duration.

bool touchEjectEnabled

true is the equivalent of setting TouchEject. And false disables it.

int autoEjectTimeout

The length of the timeout in seconds. If touchEjectEnabled is false, then the value must be 0. Otherwise, the value can be in the range ushort.MinValue through ushort.MaxValue. Where a value of 0 means that the timeout is disabled (the smart card will not be ejected automatically).

If this value is non-zero, then touchEjectEnabled must be set to true.

Implements

IYubiKeyDevice.SetLegacyDeviceConfiguration(YubiKeyCapabilities, byte, bool, int)

Exceptions

Type Condition
ArgumentException
ArgumentOutOfRangeException
InvalidOperationException

Either the command failed to complete, or the set of desired capabilities is invalid.

NotSupportedException

An error occurred when attempting to connect to the device.

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. Important: once this operation succeeds, the YubiKey must be removed from the USB slot and then reinserted. This will allow the YubiKey to initialize all of the selected modes. This operation modifies the values related to

  • EnabledUsbCapabilities
  • ChallengeResponseTimeout
  • DeviceFlags
  • AutoEjectTimeout

Interfaces are a subset of the YubiKeyCapabilities:

  • Otp
  • Ccid
  • FidoU2f
  • All
These interfaces enable or disable access to all applications that are dependent on it.

For YubiKeys with at least firmware version 5, it is recommended to use the other configuration operations in IYubiKeyDevice since they provide more fine control.

See Also

SetLegacyDeviceConfigCommand
In this article
Back to top Generated by DocFX