The Check User Key command verifies a stored user key and ensures it matches the provided authentication data. This command allows the system to check whether a registered EC256r1 or RSA 2048-bit public key is valid for authentication. It is primarily used to confirm the identity of a user without requiring a PIN, enabling secure transactions and operations.
To authenticate, the command takes a slot index (1-3) and a signed challenge (a cryptographic signature using the stored key). If the signature is correct, the key is considered valid, and the system unlocks certain functions, like signing blockchain transactions or authorizing sensitive commands. If the verification fails, the system returns an error, preventing unauthorized access.
For FIDO authentication, the command checks whether the stored FIDO key corresponds to a valid credential. In this case, it verifies the credential ID and public key against the provided signature. If successful, it allows FIDO-based authentication instead of using a PIN.
The Check User Key command ensures that only authorized users with the correct cryptographic keys can access secure features, reinforcing security by replacing PIN-based authentication with public key cryptography.
Command specifications
Check User Key Command
The Check User Key command is used to verify a stored user key and confirm it matches the provided authentication data. This command enables the system to determine whether a registered EC256r1 or RSA 2048-bit public key is valid for authentication. It plays a key role in confirming a user’s identity without needing a PIN, supporting secure transactions and operations.
Below is the Python object code snippet for the Check User Key command:
def add_user_key(slot_index: SlotIndex, data_info: str, public_key: bytes, puk: str, cred_id: bytes):
card.user_key_add(slot_index, data_info, public_key, puk, cred_id)
For example,
user_key_info = check_user_key(SlotIndex.SLOT_1)
print(user_key_info)
Application Protocol Data Unit (APDU) Components
The following table outlines the components of the Application Protocol Data Unit (APDU).
Field | Description | Value |
CLA | This field specifies the class of the instruction. | 0x80 |
INS | This field specifies the particular command or operation that the smart card or secure element should execute. | 0xD6 |
P1 | First parameter of the instruction that specifies the details about the operation being requested. | 0/x10 or 1/2 (see additional information section for more details). |
P2 | Second parameter of the instruction that specifies additional details about the operation being requested. | 0x00 |
Data | Key Data | Slotindex (1-3)
|
Response
The following table outlines the possible responses that you will receive:
Response Code | Description |
0x9000 | Success or sig fail (!) |
0x63Cx | Invalid slot index or data input format. |
0x6986 |
|
📘 Response Data
User Registration and Authentication with FIDO2
When using FIDO2 authentication, the challenge response method is used to unlock or authenticate the user, similar to a PIN. However, in this process (P1=2), the data input does not include a hash. Instead, it consists only of the counter (4 bytes) and an EC256r1 ASN1 signature.
📘 ResponseImportant Notes
Additional Information
User Key Authentication as a PIN Alternative
There are two types of authentication:
Authentication Process
Signature Requirements
PIN-Challenge-Response Authentication
Instead of entering a PIN, you can authenticate via a cryptographic challenge:
If authentication fails, a new challenge must be requested before retrying. A 0x00 response (with 0x9000 status) means the verification failed, either due to an invalid signature or an uninitialized Key.
FIDO Authentication (Slot 3)
For FIDO-based authentication, the command verifies a signature for a web authentication request.
FIDO2 Restriction
When using FIDO2 authentication for signing, a maximum of 3 hashes can be signed at once instead of 4.