Show / Hide Table of Contents

LockConfiguration Method

LockConfiguration(ReadOnlySpan<byte>)

Sets a configuration lock code, which prevents changes to YubiKey's user-settable IYubiKeyDeviceInfo values.

C#
public void LockConfiguration(ReadOnlySpan<byte> lockCode)

Parameters

Type Name Description
ReadOnlySpan<byte> lockCode

This lock code must have a length equal to LockCodeLength, and cannot be all zeros.

Implements

IYubiKeyDevice.LockConfiguration(ReadOnlySpan<byte>)

Exceptions

Type Condition
ArgumentException

The length of lockCode is invalid, or it contains all zeros.

InvalidOperationException

The command failed to complete.

NotSupportedException

An error occurred when attempting to connect to the device.

Remarks

Requires firmware version >= 5.0.0.

See ConfigurationLocked.

Once the lock code is set, no changes can be made to the YubiKey's user-settable IYubiKeyDeviceInfo values. This will block operations that attempt to modify those values, such as SetEnabledUsbCapabilities(YubiKeyCapabilities), SetAutoEjectTimeout(int), and even this one (LockConfiguration(ReadOnlySpan<byte>)). The lock code can be removed by calling UnlockConfiguration(ReadOnlySpan<byte>).

See Also

SetDeviceInfoCommand
In this article
Back to top Generated by DocFX