NOTE : This code is originally sourced from the "ACS Smart Card Reader Code Sample For Android" and has been modified.
We need APDU commands for PIN Verification. These APDU commands vary according to the type of the card. Since the card we will use is a TC ID card, we need to work with IAS-specific APDU commands. These values are as follows:
Since a 6-digit pin will be entered, we need to enter a minimum value of 6 and a maximum value of 6, that is 0606, in the Pin Extra Digit field. The data in the 'abData' section is important. This data is CLA, INS, P1, P2 and Lp (length of the pin to be entered) respectively.
CLA (Class Byte): The class indicates the type of operation to be performed, e.g. whether it is a basic operation or a special operation. For example, the CLA byte "00" often represents basic operations, while the CLA byte "80" may represent special operations.
INS (Instruction Byte): The INS byte specifies the specific instruction to be executed. This byte tells the board what operation to perform.
P1 (Parameter 1): The P1 byte indicates whether the command is associated with a specific parameter. For example, in a command to change a PIN code, the P1 byte can specify which PIN to change.
P2 (parameter 2): The P2 byte, used in conjunction with P1, specifies how the command is further associated with additional parameters. It is particularly used for more specific commands. For example, if the P1 byte indicates that a PIN is to be changed, the P2 byte can specify what operation is to be performed (e.g. changing the PIN code).
A response is returned as a result of the pin verification process.
If this response is 90 00, it means that the pin verification process was successful.
Complete list of APDU responses : https://www.eftlab.com/knowledge-base/complete-list-of-apdu-responses