LockConfiguration Method
LockConfiguration(ReadOnlySpan<Byte>)
Sets a configuration lock code, which prevents changes to YubiKey's user-settable IYubiKeyDeviceInfo values.
public void LockConfiguration(ReadOnlySpan<byte> lockCode)
Parameters
Type | Name | Description |
---|---|---|
System.ReadOnlySpan<System.Byte> | lockCode | This lock code must have a length equal to LockCodeLength, and cannot be all zeros. |
Implements
Exceptions
Type | Condition |
---|---|
System.ArgumentException | The length of |
System.InvalidOperationException | The command failed to complete. |
System.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(Int32), and even this one (LockConfiguration(ReadOnlySpan<Byte>)). The lock code can be removed by calling UnlockConfiguration(ReadOnlySpan<Byte>).