sim command

来源:百度文库 编辑:神马文学网 时间:2024/04/29 15:34:50
SIM COMMANDS
The mobile equipment communicates with the SIM using standard ISO 7816-3 Operating Procedures (a copy of parts 1, 2, and 3 can be foundhere).
This transmission protocol uses Application Protocol Data Units (APDU), which can be either commands or responses. These are sent across the electrical interface between the SIM and the mobile equipment, or the SIM-ME interface for short.
CLA
INS
P1
P2
P3
Data
Command APDU format.
There are five fields in an APDU command. The class of instruction (CLA) is always A0 for GSM. The instruction code (INS) indicates the particular command to be performed. P1, P2, and P3 are parameters for the command, with P3 containing the length of the Data segment, if any.
Data
SW1
SW2
Response APDU format.
The response to a command is returned in three fields. The Data portion, if any, contains information requested in the command. SW1 and SW2 are status words indicating the success or failure of the command.
A number of commands are defined for GSM SIM cards, including functions to read and write data, confirm security features, and run the GSM authentication algorithm. Completing an entire GSM procedure may require a series of APDU command/response pairs.
COMMAND
INS
P1
P2
P3
SELECT
A4
00
00
02
STATUS
F2
00
00
length
READ BINARY
B0
offset (high)
offset (low)
length
UPDATE BINARY
D6
offset (high)
offset (low)
length
READ RECORD
B2
record number
mode
length
UPDATE RECORD
DC
record number
mode
length
SEEK
A2
00
type/mode
length
INCREASE
32
00
00
03
VERIFY CHV
20
00
CHV number
08
CHANGE CHV
24
00
CHV number
10
DISABLE CHV
26
00
01
08
ENABLE CHV
28
00
01
08
UNBLOCK CHV
2C
00
00 (for CHV1)
02 (for CHV2)
10
INVALIDATE
04
00
00
00
REHABILITATE
44
00
00
00
RUN GSM ALGORITHM
88
00
00
00
SLEEP
FA
00
00
00
GET RESPONSE
C0
00
00
length
SIM command coding.