Package com.yubico.yubikit.yubiotp
Class HotpSlotConfiguration
java.lang.Object
com.yubico.yubikit.yubiotp.HotpSlotConfiguration
- All Implemented Interfaces:
SlotConfiguration
Configures the YubiKey to return an OATH-HOTP code 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 intprotected final byte[]protected static final intprotected final byte[]protected static final intFields 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
ConstructorsConstructorDescriptionHotpSlotConfiguration(byte[] secret) Creates an OATH-HOTP 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.digits8(boolean digits8) If set, output an 8 digit OATH-HOTP code instead of a 6 digit code.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 byteprotected HotpSlotConfigurationgetThis()imf(int imf) Set OATH Initial Moving Factor.invertLed(boolean invertLed) Inverts the behaviour of the led on the YubiKey.booleanisSupportedBy(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).serialApiVisible(boolean serialApiVisible) serialUsbVisible(boolean serialUsbVisible) tokenId(byte[] tokenId, boolean fixedModhex1, boolean fixedModhex2) Configure OATH token id with a provided value.protected HotpSlotConfigurationupdateFlags(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
-
HotpSlotConfiguration
public HotpSlotConfiguration(byte[] secret) Creates an OATH-HOTP configuration with default settings.- Parameters:
secret- the shared secret for the OATH-TOTP credential
-
-
Method Details
-
getThis
-
digits8
If set, output an 8 digit OATH-HOTP code instead of a 6 digit code.- Parameters:
digits8- true to use 8 digits of code output.- Returns:
- the configuration for chaining
-
tokenId
Configure OATH token id with a provided value. The standard OATH token id for a Yubico YubiKey is (MODHEX) OO=ub, TT=he, (BCD) UUUUUUUU=serial number.The reason for the decimal serial number is to make it easy for humans to correlate the serial number on the back of the YubiKey to an entry in a list of associated tokens for example.
NOTE: If fixedModhex1 and fixedModhex2 are BOTH set, the entire token id will be output in MODHEX.
- Parameters:
tokenId- the raw token ID valuefixedModhex1- output the first byte of the token ID as MODHEXfixedModhex2- output the first two bytes of the token ID as MODHEX- Returns:
- the configuration for chaining
-
imf
Set OATH Initial Moving Factor. This is the initial counter value for the YubiKey. This should be a value between 0 and 1048560, evenly dividable by 16.- Parameters:
imf- the initial counter value for the credential- 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:SlotConfigurationChecks the configuration against a YubiKey firmware version to see if it is supported- Specified by:
isSupportedByin 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:
getConfigin 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
-