This command allows a user to unblock PIN for a previously blocked account using a valid PUK and simultaneously set a new PIN. This feature is only available when the user PIN is in a blocked state and PinAuth is enabled. For detailed security practices, visit the FIDO Alliance PIN Management Guide for more information.
Table of Contents
Toggle
def unblock_pin(puk: str, new_pin: str):
card.unblock_pin(puk, new_pin)
# For example:
unblock_pin("09875789012", "132456122")
The following table outlines the components of the Application Protocol Data Unit (APDU) used in the unblock pin process.
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. | 0x22 |
P1 | First parameter of the instruction that specifies the details about the operation being requested. | 0x00 |
P2 | First parameter of the instruction that specifies additional details about the operation being requested. | 0x00 |
Data | Key data | The PUK followed by the new PIN |
📘
Note
- This command is used to unblock the user PIN when it has been locked due to repeated incorrect attempts.
- Requires Secure Channel to be opened.
- The PIN must be blocked and PinAuth must be enabled.
- After success, the PIN is reset and authenticated for the session.
- PUK retry is limited to 12 attempts per power cycle.
- Card must be power-cycled to retry if 0x63C0 is returned due to exhaustion.
The following table outlines the possible responses that you will receive:
Response Code | Description |
0x9000 | Success |
0x6A80 | Invalid data format (must be exactly 21 bytes) |
0x6985 | PIN is not blocked or PinAuth is disabled |
0x63Cx | Invalid PUK — x = remaining tries (up to 12 per power cycle) |
0x63C0 | No more tries left in current session — power cycle required to continue |