How to update slot settings
Some slot settings can be updated via UpdateSlot without completely reconfiguring an OTP application slot. These settings involve behaviors not related to encryption or other sensitive information.
The slot settings that can be updated include the following:
There is no way to retrieve the settings of an OTP slot configuration. Therefore, when you use UpdateSlot
, you’re
resetting every updatable setting. For example, if you intend to add a carriage return to the slot configuration and
only call SetAppendCarriageReturn()
, all other settings will revert to their default states.
Note
If you call UpdateSlot
and turn on/off serial number visibility on the USB device descriptor (
via SetSerialNumberUsbVisible()
), you must reboot the YubiKey before the changes will take effect. This is most
easily
accomplished by unplugging the key and plugging it back in.
UpdateSlot example
The following is an example of how to update the settings of a slot with UpdateSlot
. We’ll assume that the boolean
variables are set elsewhere.
using (OtpSession otp = new OtpSession(_yubiKey))
{
otp.UpdateSlot(_slot)
.UseCurrentAccessCode(_currentAccessCode)
.SetNewAccessCode(_newAccessCode)
.SetDormant(_dormant)
.SetFastTrigger(_fastTrigger)
.SetInvertLed(_invertLed)
.SetSerialNumberApiVisible(_serialApi)
.SetSerialNumberButtonVisible(_serialButton)
.SetSerialNumberUsbVisible(_serialUsb)
.SetUseNumericKeypad(_numericKeypad)
.SetSendTabFirst(_sendTabFirst)
.SetAppendTabToFixed(_appendTabToFixed)
.SetAppendTabToOtp(_appendTabToOtp)
.SetAppendDelayToFixed(_appendDelayToFixed)
.SetAppendDelayToOtp(_appendDelayToOtp)
.SetAppendCarriageReturn(!_noEnter)
.SetUse10msPacing(_use10msPacing)
.SetUse20msPacing(_use20msPacing)
.SetAllowUpdate(_allowUpdate)
.ProtectLongPressSlot(_protectLongPressSlot)
.Execute();
}
Slot reconfiguration and access codes
If a slot is protected by an access code and you wish to reconfigure slot settings, you must provide that access code
with UseCurrentAccessCode()
during the UpdateSlot()
operation. Otherwise, the operation will fail and throw the
following exception:
System.InvalidOperationException has been thrown. YubiKey Operation Failed. [Warning, state of non-volatile memory is unchanged.]
For more information on slot access codes, please see How to set, reset, remove, and use slot access codes.