In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what the APDU instruction format is, which has a certain reference value. Interested friends can refer to it. I hope you can learn a lot after reading this article.
CLA INS P1 P2 Lc Data Le
Where CLA is the instruction category; INS is the instruction code; P1 and P2 are parameters; Lc is the length of Data; Le is the number of data bytes to be answered when you want to respond, and the maximum possible length of table 0.
A command classification:
According to the specific application, the COS command is divided into four types of command message structure as follows:
① scenario 1
CLA INS P1 P2 00
② scenario 2
CLA INS P1 P2 Le
③ scenario 3
CLA INS P1 P2 Lc Data
④ scenario 4
CLA INS P1 P2 Lc Data Le
Two response message
1) response structure
Response data response status code
Data SW1 SW1
DATA: the data returned to the user, that is, the result of the execution of the command.
SW1, SW2: returns the status of command processing.
Three command sets
1) Read Binary
Function: this command is used to read some or all of the contents of the binary file.
CLA 00
INS B0
P1 see the parameter description
P2 offset address of the first byte read from the file
Le expects the length of the readout data
2) Update Binary
Function: this command updates some or all of the contents of the binary file with the given data.
CLA 00
INS D6
P1 see the parameter description
Offset address of the first byte to be modified by P2
Length of subsequent data fields of Lc
Data for Data modification
3) Read Record
Function: this command is used to read the contents of the specified record in the record file.
CLA 00
INS B2
P1 record number
P2 see the parameter description
Le expects the length of the readout data
4) Update record
Function: this command updates the contents of the specified record in the record file with the given data. When the specified file is not a record file, the command terminates.
CLA 00
INS DC
P1 P1 = 00 indicates the current record
P1 ≠ 00 indicates the specified record number
P2 see the parameter description
Length of subsequent data fields of Lc
Data updates the new record of the original record
5) Verify PIN
Function: this command will verify the correctness of the given password, modify the security status according to the comparison results, and automatically lock the PIN if the number of verification failures reaches the upper limit of PIN attempts.
CLA 00
INS 20
P1 00
P2
Lc 02 ~ 10
Personal password entered externally by Data
6) Select File
Function: this command uses the file name or application identifier to select DF or EF in the IC card.
CLA 00
INS A4
P1 00
P2 00
Lc 00 (Select MF file) / 02
Data none / FID
7) Get Challenge
Function: this command requests the IC card to return a random number for security-related processes.
CLA 00
INS 84
P1 00
P2 00
Le 04
8) Get Response
Function: this command is used to retrieve the data returned in the card in the Tunable 0 protocol case 4 state.
Format:
CLA 00
INS C0
P1 00
P2 00
Maximum expected data length of Le response
9) Internal Authenticate
Function: this command will provide data for external devices to verify the validity of the secret module in the card.
CLA 00
INS 88
P1 00
P200 ~ 07 key number
Lc 04
External random number of Data (4 bytes)
10) External Authenticate
Function: this command will verify the validity of the secret module in the external device.
CLA 00
INS 82
P1 00
P200 ~ 07 key number
Lc 0C
Data card issuer authentication data
11) Change / Unlock PIN
Function: modify, unlock and install card personal password.
CLA 00
INS 5E
P100 modifies the card personal password
01 unlock the card personal password
02 security (reload) card personal password
P2 password number
Lc
Data
12) Unlock Key
Function: unlock the card application key.
CLA 00
INS 5C
P1 01 unlock the application key
02 install card application key
P2 key number
Lc none / key length
Data No / encrypted key
13) Create File
Function: this command creates a card file system.
CLA 00 / 80
INS F2
P100 / FTP file type
P200 / FAC file access control conditions
Lc none / 07
Data
Example:
1 Application selection
(1) Select MF (master file)
CLA INS P1 P2 Lc Data
00 A4 00 00
P1room00 Select the master file
(2) Select applications according to application identifiers
CLA INS P1 P2 Lc Data
00 A4 04 0C 07 A0 00 00 02 47 10 01
P1Secret04 Select DF (dedicated file), where the data field is the file name of DF (AID application identifier)
DF includes EF (basic files) and other DF
DF1:EF.COM 、 EF.DG1....EF.DG16 、 EF.Sod
2 use the SELECT command to select the basic file
Example: select machine read area
CLA INS P1 P2 Lc Data
00 A4 02 0C 02 01 01
3 read binary
CLA INS P1 P2 Lc Data
00 B005 00 00 / / 256Byte before reading the file
If the highest bit b8 of P1 is 1, the bits b6 and b7 must be the SFI; that represents the basic file to be read, and then P2 indicates the offset of the starting position of the data in the file.
If the highest bit of P1 is 0, the last 7 bits of P1 and P2 are connected to form an integer of more than 256, indicating the offset of the starting position of the data block to be read in the file, which can be used to exceed the reading of 256Byte files.
Thank you for reading this article carefully. I hope the article "what is the format of APDU instructions shared by the editor is helpful to everyone?" at the same time, I also hope that you will support and pay attention to the industry information channel, and more related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.