Package com.yubico.yubikit.yubiotp
Class YubiOtpSlotConfiguration
java.lang.Object
com.yubico.yubikit.yubiotp.YubiOtpSlotConfiguration
- All Implemented Interfaces:
SlotConfiguration
Configures the YubiKey to return YubiOTP (one-time password) on touch.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.yubico.yubikit.yubiotp.SlotConfiguration
SlotConfiguration.Flag, SlotConfiguration.FlagType, SlotConfiguration.NonFailingFlag
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]
protected static final int
protected final byte[]
protected static final int
protected final byte[]
protected static final int
Fields inherited from interface com.yubico.yubikit.yubiotp.SlotConfiguration
CFGFLAG_ALLOW_HIDTRIG, CFGFLAG_CHAL_BTN_TRIG, CFGFLAG_CHAL_HMAC, CFGFLAG_CHAL_YUBICO, CFGFLAG_HMAC_LT64, CFGFLAG_MAN_UPDATE, CFGFLAG_OATH_FIXED_MODHEX1, CFGFLAG_OATH_FIXED_MODHEX2, CFGFLAG_OATH_HOTP8, CFGFLAG_PACING_10MS, CFGFLAG_PACING_20MS, CFGFLAG_SEND_REF, CFGFLAG_SHORT_TICKET, CFGFLAG_STATIC_TICKET, CFGFLAG_STRONG_PW1, CFGFLAG_STRONG_PW2, CFGFLAG_TICKET_FIRST, EXTFLAG_ALLOW_UPDATE, EXTFLAG_DORMANT, EXTFLAG_FAST_TRIG, EXTFLAG_LED_INV, EXTFLAG_SERIAL_API_VISIBLE, EXTFLAG_SERIAL_BTN_VISIBLE, EXTFLAG_SERIAL_USB_VISIBLE, EXTFLAG_USE_NUMERIC_KEYPAD, TKTFLAG_APPEND_CR, TKTFLAG_APPEND_DELAY1, TKTFLAG_APPEND_DELAY2, TKTFLAG_APPEND_TAB1, TKTFLAG_APPEND_TAB2, TKTFLAG_CHAL_RESP, TKTFLAG_OATH_HOTP, TKTFLAG_PROTECT_CFG2, TKTFLAG_TAB_FIRST
-
Constructor Summary
ConstructorsConstructorDescriptionYubiOtpSlotConfiguration
(byte[] fixed, byte[] uid, byte[] key) Creates a Yubico OTP configuration with default settings. -
Method Summary
Modifier and TypeMethodDescriptionallowUpdate
(boolean allowUpdate) appendCr
(boolean appendCr) Appends a Carriage Return (Enter key press) at the end of the output.delay
(boolean afterFirst, boolean afterSecond) Inserts delays in-between different parts of the OTP.dormant
(boolean dormant) Makes the configuration dormant (hidden from use).fastTrigger
(boolean fastTrigger) Faster triggering when only slot 1 is configured.byte[]
getConfig
(byte[] accCode) protected final byte
protected YubiOtpSlotConfiguration
getThis()
invertLed
(boolean invertLed) Inverts the behaviour of the led on the YubiKey.boolean
isSupportedBy
(com.yubico.yubikit.core.Version version) Checks the configuration against a YubiKey firmware version to see if it is supportedpacing
(boolean pacing10Ms, boolean pacing20Ms) Adds a delay between each key press when sending output.protectSlot2
(boolean protectSlot2) When set for slot 1, access to modify slot 2 is blocked (even if slot 2 is empty).sendReference
(boolean sendReference) Send a reference string of all 16 modhex characters before the OTP.serialApiVisible
(boolean serialApiVisible) serialUsbVisible
(boolean serialUsbVisible) tabs
(boolean before, boolean afterFirst, boolean afterSecond) Inserts tabs in-between different parts of the OTP.protected YubiOtpSlotConfiguration
updateFlags
(SlotConfiguration.Flag flag, boolean value) useNumeric
(boolean useNumeric) Send scancodes for numeric keypad key presses when sending digits - helps with some keyboard layouts.
-
Field Details
-
FIXED_SIZE
protected static final int FIXED_SIZE- See Also:
-
UID_SIZE
protected static final int UID_SIZE- See Also:
-
KEY_SIZE
protected static final int KEY_SIZE- See Also:
-
fixed
protected byte[] fixed -
uid
protected final byte[] uid -
key
protected final byte[] key
-
-
Constructor Details
-
YubiOtpSlotConfiguration
public YubiOtpSlotConfiguration(byte[] fixed, byte[] uid, byte[] key) Creates a Yubico OTP configuration with default settings.- Parameters:
fixed
- "public ID" static portion of each OTP (0-16 bytes)uid
- "private id" internal to the credential (6 bytes)key
- the AES key to encrypt the OTP payload (20 bytes)
-
-
Method Details
-
getThis
-
tabs
Inserts tabs in-between different parts of the OTP.- Parameters:
before
- inserts a tab before any other output (default: false)afterFirst
- inserts a tab after the static part of the OTP (default: false)afterSecond
- inserts a tab after the end of the OTP (default: false)- Returns:
- the configuration for chaining
-
delay
Inserts delays in-between different parts of the OTP.- Parameters:
afterFirst
- inserts a delay after the static part of the OTP (default: false)afterSecond
- inserts a delay after the end of the OTP (default: false)- Returns:
- the configuration for chaining
-
sendReference
Send a reference string of all 16 modhex characters before the OTP.- Parameters:
sendReference
- if true, sends the reference string (default: false)- Returns:
- the configuration for chaining
-
appendCr
Appends a Carriage Return (Enter key press) at the end of the output.- Parameters:
appendCr
- if true, the output of the slot will end with a CR (default: true)- Returns:
- the configuration for chaining
-
fastTrigger
Faster triggering when only slot 1 is configured. This option is always in effect on firmware versions 3.0 and above.- Parameters:
fastTrigger
- if true, trigger slot 1 quicker when slot 2 is not configured (default: true)- Returns:
- the configuration for chaining
-
pacing
Adds a delay between each key press when sending output. This may sometimes be needed if the host system isn't able to handle the default speed at which keystrokes are sent.NOTE: These two flags can be combined to maximize the delay.
- Parameters:
pacing10Ms
- Adds a ~10ms delay between keystrokes (default: false)pacing20Ms
- Adds a ~20ms delay between keystrokes (default: false)- Returns:
- the configuration for chaining
-
useNumeric
Send scancodes for numeric keypad key presses when sending digits - helps with some keyboard layouts.- Parameters:
useNumeric
- true to use the numeric keypad (default: false)- Returns:
- the configuration for chaining
-
getFlags
-
updateFlags
-
isSupportedBy
public boolean isSupportedBy(com.yubico.yubikit.core.Version version) Description copied from interface:SlotConfiguration
Checks the configuration against a YubiKey firmware version to see if it is supported- Specified by:
isSupportedBy
in interfaceSlotConfiguration
- Parameters:
version
- the firmware version to check against- Returns:
- true if the given YubiKey version supports this configuration
-
getConfig
public byte[] getConfig(@Nullable byte[] accCode) - Specified by:
getConfig
in interfaceSlotConfiguration
-
serialApiVisible
-
serialUsbVisible
-
allowUpdate
-
dormant
Makes the configuration dormant (hidden from use). A dormant configuration needs to be updated and the dormant bit removed to be used.- Parameters:
dormant
- if true, the configuration cannot be used- Returns:
- the configuration for chaining
-
invertLed
Inverts the behaviour of the led on the YubiKey.- Parameters:
invertLed
- if true, the LED behavior is inverted- Returns:
- the configuration for chaining
-
protectSlot2
When set for slot 1, access to modify slot 2 is blocked (even if slot 2 is empty).- Parameters:
protectSlot2
- If true, slot 2 cannot be modified.- Returns:
- the configuration for chaining
-