Class ClientPin

java.lang.Object
com.yubico.yubikit.fido.ctap.ClientPin

public class ClientPin extends Object
Implements Client PIN commands.
  • Field Details

  • Constructor Details

    • ClientPin

      public ClientPin(Ctap2Session ctap, PinUvAuthProtocol pinUvAuth)
      Construct a new ClientPin object using a specified PIN/UV Auth protocol.
      Parameters:
      ctap - an active CTAP2 connection
      pinUvAuth - the PIN/UV Auth protocol to use
  • Method Details

    • isSupported

      public static boolean isSupported(Ctap2Session.InfoData infoData)
    • isTokenSupported

      public static boolean isTokenSupported(Ctap2Session.InfoData infoData)
    • getPinUvAuth

      public PinUvAuthProtocol getPinUvAuth()
      Get the underlying Pin/UV Auth protocol in use.
      Returns:
      the PinUvAuthProtocol in use
    • getPinToken

      public byte[] getPinToken(char[] pin, @Nullable Integer permissions, @Nullable String permissionsRpId) throws IOException, com.yubico.yubikit.core.application.CommandException
      Get a pinToken from the YubiKey which can be use to authenticate commands for the given session.
      Parameters:
      pin - The FIDO PIN set for the YubiKey.
      permissions - requested permissions
      permissionsRpId - rpId for token used in permission context
      Returns:
      A pinToken valid for the current CTAP2 session.
      Throws:
      IOException - A communication error in the transport layer.
      com.yubico.yubikit.core.application.CommandException - A communication in the protocol layer.
    • getUvToken

      public byte[] getUvToken(@Nullable Integer permissions, @Nullable String permissionsRpId, @Nullable com.yubico.yubikit.core.application.CommandState state) throws IOException, com.yubico.yubikit.core.application.CommandException
      Get a UV Token from the YubiKey which can be use to authenticate commands for the given session.
      Parameters:
      permissions - requested permissions
      permissionsRpId - rpId for token used in permission context
      state - If needed, the state to provide control over the ongoing operation
      Returns:
      A pinToken valid for the current CTAP2 session.
      Throws:
      IOException - A communication error in the transport layer.
      com.yubico.yubikit.core.application.CommandException - A communication in the protocol layer.
    • getPinRetries

      public ClientPin.PinRetries getPinRetries() throws IOException, com.yubico.yubikit.core.application.CommandException
      Get the number of invalid PIN attempts available before the PIN becomes blocked and the power cycle state, if available.
      Returns:
      A pair invalid PIN attempts available before the PIN becomes blocked and the power cycle state, if available.
      Throws:
      IOException - A communication error in the transport layer.
      com.yubico.yubikit.core.application.CommandException - A communication in the protocol layer.
    • getUvRetries

      public int getUvRetries() throws IOException, com.yubico.yubikit.core.application.CommandException
      Get the number of UV retries remaining.
      Returns:
      The number of UV retries remaining.
      Throws:
      IOException - A communication error in the transport layer.
      com.yubico.yubikit.core.application.CommandException - A communication in the protocol layer.
    • setPin

      public void setPin(char[] pin) throws IOException, com.yubico.yubikit.core.application.CommandException
      Set the FIDO PIN on a YubiKey with no PIN currently set.
      Parameters:
      pin - The PIN to set
      Throws:
      IOException - A communication error in the transport layer.
      com.yubico.yubikit.core.application.CommandException - A communication in the protocol layer.
    • changePin

      public void changePin(char[] currentPin, char[] newPin) throws IOException, com.yubico.yubikit.core.application.CommandException
      Change the FIDO PIN on a YubiKey.
      Parameters:
      currentPin - The currently set PIN
      newPin - The new PIN to set
      Throws:
      IOException - A communication error in the transport layer.
      com.yubico.yubikit.core.application.CommandException - A communication in the protocol layer.