Package com.yubico.yubikit.fido.ctap
Class Ctap1Session
java.lang.Object
com.yubico.yubikit.core.application.ApplicationSession<CtapSession>
com.yubico.yubikit.fido.ctap.CtapSession
com.yubico.yubikit.fido.ctap.Ctap1Session
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
Ctap2Session
Implementation of the CTAP1 (U2F) specification.
This class provides methods for U2F registration and authentication operations using the legacy CTAP1 protocol, also known as FIDO U2F.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBinary response data for a CTAP1 (U2F) registration.static classBinary response data for a CTAP1 (U2F) authentication. -
Constructor Summary
ConstructorsConstructorDescriptionCtap1Session(com.yubico.yubikit.core.fido.FidoConnection connection) Creates a new CTAP1 session from a FIDO connection.Ctap1Session(com.yubico.yubikit.core.smartcard.SmartCardConnection connection) Ctap1Session(com.yubico.yubikit.core.smartcard.SmartCardConnection connection, @Nullable com.yubico.yubikit.core.smartcard.scp.ScpKeyParams scpKeyParams) Creates a new CTAP1 session from a SmartCard connection. -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(byte[] clientParam, byte[] appParam, byte[] keyHandle, boolean checkOnly) Authenticates a previously registered credential.voidclose()Gets the U2F version implemented by the authenticator.com.yubico.yubikit.core.VersionGets the version of the YubiKey firmware.register(byte[] clientParam, byte[] appParam) Registers a new U2F credential.Methods inherited from class com.yubico.yubikit.core.application.ApplicationSession
require, supports
-
Constructor Details
-
Ctap1Session
public Ctap1Session(com.yubico.yubikit.core.smartcard.SmartCardConnection connection) throws IOException, com.yubico.yubikit.core.application.CommandException - Throws:
IOExceptioncom.yubico.yubikit.core.application.CommandException
-
Ctap1Session
public Ctap1Session(com.yubico.yubikit.core.smartcard.SmartCardConnection connection, @Nullable com.yubico.yubikit.core.smartcard.scp.ScpKeyParams scpKeyParams) throws IOException, com.yubico.yubikit.core.application.CommandException Creates a new CTAP1 session from a SmartCard connection.- Parameters:
connection- a SmartCard/NFC connection- Throws:
IOException- if communication with the device failscom.yubico.yubikit.core.application.ApplicationNotAvailableException- if the FIDO application is not availablecom.yubico.yubikit.core.application.CommandException
-
Ctap1Session
public Ctap1Session(com.yubico.yubikit.core.fido.FidoConnection connection) throws IOException, com.yubico.yubikit.core.application.CommandException Creates a new CTAP1 session from a FIDO connection.- Parameters:
connection- a FIDO HID connection- Throws:
IOException- if communication with the device failscom.yubico.yubikit.core.application.CommandException
-
-
Method Details
-
close
- Throws:
IOException
-
getVersion
public com.yubico.yubikit.core.Version getVersion()Gets the version of the YubiKey firmware.For USB connections, this returns the version from the HID device. For NFC connections, version information is not available and returns 0.0.0.
- Specified by:
getVersionin classcom.yubico.yubikit.core.application.ApplicationSession<CtapSession>- Returns:
- the YubiKey firmware version
-
getU2fVersion
public String getU2fVersion() throws IOException, com.yubico.yubikit.core.smartcard.ApduException, com.yubico.yubikit.core.fido.CtapExceptionGets the U2F version implemented by the authenticator. The only version specified is "U2F_V2".- Returns:
- a U2F version string
- Throws:
IOException- if communication failscom.yubico.yubikit.core.smartcard.ApduException- if the command returns an error statuscom.yubico.yubikit.core.fido.CtapException
-
register
public Ctap1Session.RegistrationData register(byte[] clientParam, byte[] appParam) throws IOException, com.yubico.yubikit.core.smartcard.ApduException, com.yubico.yubikit.core.fido.CtapException Registers a new U2F credential.- Parameters:
clientParam- SHA256 hash of the ClientData used for the requestappParam- SHA256 hash of the app ID used for the request- Returns:
- the registration response from the authenticator
- Throws:
IOException- if communication failscom.yubico.yubikit.core.smartcard.ApduException- if the command returns an error statuscom.yubico.yubikit.core.fido.CtapException- See Also:
-
authenticate
public Ctap1Session.SignatureData authenticate(byte[] clientParam, byte[] appParam, byte[] keyHandle, boolean checkOnly) throws IOException, com.yubico.yubikit.core.smartcard.ApduException, com.yubico.yubikit.core.fido.CtapException Authenticates a previously registered credential.- Parameters:
clientParam- SHA256 hash of the ClientData used for the requestappParam- SHA256 hash of the app ID used for the requestkeyHandle- the binary key handle of the credentialcheckOnly- true to send a "check-only" request to determine if a key handle is known- Returns:
- the authentication response from the authenticator
- Throws:
IOException- if communication failscom.yubico.yubikit.core.smartcard.ApduException- if the command returns an error statuscom.yubico.yubikit.core.fido.CtapException- See Also:
-