Package com.yubico.yubikit.yubiotp
Class HmacSha1SlotConfiguration
- java.lang.Object
-
- com.yubico.yubikit.yubiotp.HmacSha1SlotConfiguration
-
- All Implemented Interfaces:
SlotConfiguration
public class HmacSha1SlotConfiguration extends java.lang.ObjectConfigures 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
Fields Modifier and Type Field Description protected byte[]fixedprotected static intFIXED_SIZEprotected byte[]keyprotected static intKEY_SIZEprotected byte[]uidprotected static intUID_SIZE-
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
Constructors Constructor Description HmacSha1SlotConfiguration(byte[] secret)Creates a HMAC-SHA1 challenge-response configuration with default settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TallowUpdate(boolean allowUpdate)Tdormant(boolean dormant)Makes the configuration dormant (hidden from use).byte[]getConfig(byte[] accCode)protected bytegetFlags(SlotConfiguration.FlagType type)protected HmacSha1SlotConfigurationgetThis()TinvertLed(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 supportedHmacSha1SlotConfigurationlt64(boolean lt64)Whether or not challenges sent to this slot are less than 64 bytes long or not.TprotectSlot2(boolean protectSlot2)When set for slot 1, access to modify slot 2 is blocked (even if slot 2 is empty).HmacSha1SlotConfigurationrequireTouch(boolean requireTouch)Whether or not to require a user presence check for calculating the response.TserialApiVisible(boolean serialApiVisible)TserialUsbVisible(boolean serialUsbVisible)protected TupdateFlags(SlotConfiguration.Flag flag, boolean value)
-
-
-
Field Detail
-
FIXED_SIZE
protected static final int FIXED_SIZE
- See Also:
- Constant Field Values
-
UID_SIZE
protected static final int UID_SIZE
- See Also:
- Constant Field Values
-
KEY_SIZE
protected static final int KEY_SIZE
- See Also:
- Constant Field Values
-
fixed
protected byte[] fixed
-
uid
protected final byte[] uid
-
key
protected final byte[] key
-
-
Method Detail
-
getThis
protected HmacSha1SlotConfiguration getThis()
-
requireTouch
public HmacSha1SlotConfiguration requireTouch(boolean 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
public HmacSha1SlotConfiguration lt64(boolean 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
protected final byte getFlags(SlotConfiguration.FlagType type)
-
updateFlags
protected T updateFlags(SlotConfiguration.Flag flag, boolean value)
-
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
public T serialApiVisible(boolean serialApiVisible)
-
serialUsbVisible
public T serialUsbVisible(boolean serialUsbVisible)
-
allowUpdate
public T allowUpdate(boolean allowUpdate)
-
dormant
public T dormant(boolean 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
public T invertLed(boolean 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
public T protectSlot2(boolean 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
-
-