Package com.yubico.yubikit.fido.ctap
Class ClientPin
java.lang.Object
com.yubico.yubikit.fido.ctap.ClientPin
Implements Client PIN commands.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
ConstructorsConstructorDescriptionClientPin
(Ctap2Session ctap, PinUvAuthProtocol pinUvAuth) Construct a new ClientPin object using a specified PIN/UV Auth protocol. -
Method Summary
Modifier and TypeMethodDescriptionvoid
changePin
(char[] currentPin, char[] newPin) Change the FIDO PIN on a YubiKey.Get the number of invalid PIN attempts available before the PIN becomes blocked and the power cycle state, if available.byte[]
getPinToken
(char[] pin, Integer permissions, String permissionsRpId) Get a pinToken from the YubiKey which can be use to authenticate commands for the given session.Get the underlying Pin/UV Auth protocol in use.int
Get the number of UV retries remaining.byte[]
getUvToken
(Integer permissions, String permissionsRpId, com.yubico.yubikit.core.application.CommandState state) Get a UV Token from the YubiKey which can be use to authenticate commands for the given session.static boolean
isSupported
(Ctap2Session.InfoData infoData) static boolean
isTokenSupported
(Ctap2Session.InfoData infoData) void
setPin
(char[] pin) Set the FIDO PIN on a YubiKey with no PIN currently set.
-
Field Details
-
PIN_PERMISSION_MC
public static final int PIN_PERMISSION_MC- See Also:
-
PIN_PERMISSION_GA
public static final int PIN_PERMISSION_GA- See Also:
-
PIN_PERMISSION_CM
public static final int PIN_PERMISSION_CM- See Also:
-
PIN_PERMISSION_BE
public static final int PIN_PERMISSION_BE- See Also:
-
PIN_PERMISSION_LBW
public static final int PIN_PERMISSION_LBW- See Also:
-
PIN_PERMISSION_ACFG
public static final int PIN_PERMISSION_ACFG- See Also:
-
-
Constructor Details
-
ClientPin
Construct a new ClientPin object using a specified PIN/UV Auth protocol.- Parameters:
ctap
- an active CTAP2 connectionpinUvAuth
- the PIN/UV Auth protocol to use
-
-
Method Details
-
isSupported
-
isTokenSupported
-
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 permissionspermissionsRpId
- 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 permissionspermissionsRpId
- rpId for token used in permission contextstate
- 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.CommandExceptionGet 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
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 PINnewPin
- 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.
-