Class HmacSha1SlotConfiguration

java.lang.Object
com.yubico.yubikit.yubiotp.HmacSha1SlotConfiguration
All Implemented Interfaces:
SlotConfiguration

public class HmacSha1SlotConfiguration extends Object
Configures HMAC-SHA1 challenge response secret on YubiKey (YubiOtpSession.calculateHmacSha1(Slot, byte[], CommandState) how to use it after configuration)
  • 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

      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 HmacSha1SlotConfiguration updateFlags(SlotConfiguration.Flag flag, boolean value)
    • 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 interface SlotConfiguration
      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 interface SlotConfiguration
    • serialApiVisible

      public HmacSha1SlotConfiguration serialApiVisible(boolean serialApiVisible)
    • serialUsbVisible

      public HmacSha1SlotConfiguration serialUsbVisible(boolean serialUsbVisible)
    • allowUpdate

      public HmacSha1SlotConfiguration allowUpdate(boolean allowUpdate)
    • dormant

      public HmacSha1SlotConfiguration 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 HmacSha1SlotConfiguration 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 HmacSha1SlotConfiguration 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