Package com.yubico.yubikit.yubiotp
Class HmacSha1SlotConfiguration
java.lang.Object
com.yubico.yubikit.yubiotp.HmacSha1SlotConfiguration
- All Implemented Interfaces:
SlotConfiguration
Configures HMAC-SHA1 challenge response secret on YubiKey (
YubiOtpSession.calculateHmacSha1(Slot, byte[], CommandState) how to use it after configuration)-
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
ConstructorsConstructorDescriptionHmacSha1SlotConfiguration(byte[] secret) Creates a HMAC-SHA1 challenge-response configuration with default settings. -
Method Summary
Modifier and TypeMethodDescriptionallowUpdate(boolean allowUpdate) dormant(boolean dormant) Makes the configuration dormant (hidden from use).byte[]getConfig(byte @Nullable [] accCode) protected final byteprotected HmacSha1SlotConfigurationgetThis()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 supportedlt64(boolean lt64) Whether or not challenges sent to this slot are less than 64 bytes long or not.protectSlot2(boolean protectSlot2) When set for slot 1, access to modify slot 2 is blocked (even if slot 2 is empty).requireTouch(boolean requireTouch) Whether or not to require a user presence check for calculating the response.serialApiVisible(boolean serialApiVisible) serialUsbVisible(boolean serialUsbVisible) protected HmacSha1SlotConfigurationupdateFlags(SlotConfiguration.Flag flag, boolean value)
-
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
-
HmacSha1SlotConfiguration
public HmacSha1SlotConfiguration(byte[] secret) Creates a HMAC-SHA1 challenge-response configuration with default settings.- Parameters:
secret- the 20 bytes HMAC key to store
-
-
Method Details
-
getThis
-
requireTouch
Whether or not to require a user presence check for calculating the response.- Parameters:
requireTouch- if true, any attempt to calculate a response will cause the YubiKey to require touch (default: false)- Returns:
- the configuration for chaining
-
lt64
Whether or not challenges sent to this slot are less than 64 bytes long or not.- Parameters:
lt64- if false, all challenges must be exactly 64 bytes long (default: true)- 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(byte @Nullable [] 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
-