Authentication
PIN authentication
The PIN chosen during the initialization needs to be provided after each EC signature, because a signature resets the PIN validity.
The PIN verification is done in a standard way through the secure channel. The PIN must be between 4 and 9 figures long.
Retry behavior
Event |
Behavior |
|---|---|
Per-session tries |
The PIN can be tested 3 times before a disconnection of the card is required. |
After power cycle |
3 more tries are available before the PIN state is locked. |
PIN locked |
Requires unlocking with the PUK via the |
|
Returned when tries need a power cycle, even if the PIN is correct. |
Persistent |
After power cycle, if the card still throws |
After a successful signature command, the PIN verification is reset. A PIN verification is valid until the card powers off or a signature is performed.
See also
VERIFY PIN command for the full APDU specification
Status codes reference for PIN and PUK retry counter details
User key authentication
Another way to authenticate the user is with an EC256r1 or RSA key pair. There is a
random challenge to be signed for PIN-like behavior. The public key is registered in the card,
and the “blockchain” EC signature can be allowed with a signature from this user key: hash to be
signed with the card must be signed with the user key.
The goal of this function is to use the Cryptnox Hardware Wallet card (to make transactions) in conjunction with a key storage such as iOS Secure Enclave Touch ID or a PC TPM, instead of using the PIN.
The PIN check and user authentication is reset after any EC signature (of all the authorized hashes).
This user auth by ECDSA can also be performed by an external FIDO authenticator.
A user key can be uploaded in a slot only once, and requires the DELETE USER KEY command if
there is already a key in the slot.
Key slots
Slot |
Key type |
Format |
|---|---|---|
1 |
|
X9.62 uncompressed (65 bytes: |
2 |
|
256 bytes modulus, exponent must be |
3 |
FIDO |
|
Authentication modes
There are 2 kinds of user auth:
Mode |
P1 |
Description |
|---|---|---|
Challenge-response |
|
Auth for all commands except |
Auth for sign |
|
Auth the transaction hash. The challenge is one or a set of hashes to be
“blockchain” signed. When |
FIDO authentication
When the slot index is 3, this is a special case for a FIDO signature. The data must include the counter, making the data input:
hash(33-97B) | counter(4B) | ECsignature(EC256r1 ASN1)
The card checks the signature as a WebAuthn “user verified” message:
sha256hash(rp_id) | [0x05] | counter_word | sha256hash(clientData)
Where:
rp_id="cryptnox.ch"clientData='{"type": "webauthn.get", "origin": "https://cryptnox.ch", "challenge": "", "clientExtensions": {}}'
Note
The restriction for FIDO2 user-auth-for-sign is a maximum of 3 hashes can be authorized at once (instead of 4).
Disabling PIN auth
With the SET PIN AUTH command, one can disable the PIN auth and only let the auth performed
by user authentication (public keys registered).
Important
When PIN auth is disabled, only user key authentication (slots 1–3) can authorize operations. Make sure at least one user key is registered before disabling PIN auth.
See also
ADD USER KEY, CHECK USER KEY, and SET PIN AUTH commands for full APDU specifications
EC signature for details on how signing resets authentication state