Class StaticTicketSlotConfiguration

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

public class StaticTicketSlotConfiguration extends Object
Configures the YubiKey to output a Static Ticket.

NOTE: StaticPasswordSlotConfiguration is a better choice in most cases!

A Static Ticket behaves like a Yubico OTP, but with all changing state removed.

  • 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

    • StaticTicketSlotConfiguration

      public StaticTicketSlotConfiguration(byte[] fixed, byte[] uid, byte[] key)
      Creates a Static Ticket configuration with default settings.
      Parameters:
      fixed - data to use for the fixed portion of the ticket
      uid - uid value (corresponds to a Yubico OTP private ID)
      key - AES key used to generate the "dynamic" part of the ticket
  • Method Details

    • getThis

      protected StaticTicketSlotConfiguration getThis()
    • shortTicket

      public StaticTicketSlotConfiguration shortTicket(boolean shortTicket)
      Truncate the OTP-portion of the ticket to 16 characters.
      Parameters:
      shortTicket - if true, the OTP is truncated to 16 characters (default: false)
      Returns:
      the configuration for chaining
    • strongPassword

      public StaticTicketSlotConfiguration strongPassword(boolean upperCase, boolean digit, boolean special)
      Modifier flags to alter the output string to conform to password validation rules.

      NOTE: special=true implies digits=true, and cannot be used without it.

      Parameters:
      upperCase - if true the two first letters of the output string are upper-cased (default: false)
      digit - if true the first eight characters of the modhex alphabet are replaced with the numbers 0 to 7 (default: false)
      special - if true a ! is sent as the very first character, and digits is implied (default: false)
      Returns:
      the configuration for chaining
    • manualUpdate

      public StaticTicketSlotConfiguration manualUpdate(boolean manualUpdate)
      Enabled Manual Update of the static ticket.

      NOTE: This feature is ONLY supported on YubiKey 2.x

      Manual update is triggered by the user by holding the sensor pressed for 8-15 seconds. This will generate a new random static ticket to be used, until manual update is again invoked.

      Parameters:
      manualUpdate - if true, enable user-initiated manual update (default: false)
      Returns:
      the configuration for chaining
    • appendCr

      public StaticTicketSlotConfiguration appendCr(boolean 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

      public StaticTicketSlotConfiguration fastTrigger(boolean 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

      public StaticTicketSlotConfiguration pacing(boolean pacing10Ms, boolean pacing20Ms)
      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

      public StaticTicketSlotConfiguration useNumeric(boolean 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

      protected final byte getFlags(SlotConfiguration.FlagType type)
    • updateFlags

      protected StaticTicketSlotConfiguration 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 StaticTicketSlotConfiguration serialApiVisible(boolean serialApiVisible)
    • serialUsbVisible

      public StaticTicketSlotConfiguration serialUsbVisible(boolean serialUsbVisible)
    • allowUpdate

      public StaticTicketSlotConfiguration allowUpdate(boolean allowUpdate)
    • dormant

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