B0-READ BINARY
B0即透明EF里面的内容binary(二进制),该指令一般在C0之后执行,在C0返回的fcp里面可以判断到该文件下是否存在binary及binary的长度,如果存在即可用B0需要读的字节长度。B0里面存的内容一般比较重要,如我们最常用的两个SIM卡信息,ICCID和IMSI就存在各自文件的B0里面。
B0指令比较固定,00 B0 00 00 XX(XX代表要读取的长度)
1.正常读取
当读B0时,解析fcp里面的内容可知B0长度为多少(88之前的两个字节),后面就用解析到的长度进行B0的读取即可,00 B0 00 00 XX(长度)
ICCID:2FE2
=>00 A4 00 04 02
<=A4
=>2F E2
<=61 19 //返回长度0x19
=>00 C0 00 00 19 //读取0x19的fcp数据
<=C0 62178202412183022FE28A01058B032F06018002000A880110 9000
=>00 B0 00 00 0A
<=B0 9868200B326101550494 9000 //90 00正常结束
IMSI:6F07
=>00 A4 08 04 04
<=A4
=>7FFF6F07
<=61 19 //返回长度0x19
=>00 C0 00 00 19 //读取0x19的fcp数据
<=C0 62178202412183026F078A01058B036F060380020009880138 9000
=>00 B0 00 00 09
<=B0 084906409160066622 9000 //90 00正常结束
2.读取少于原有数据
当读B0时,解析fcp里面的内容可知B0长度为0A,但是却只想读取少于0A的内容,如0x06,则就会返回0x06的长度,并以90 00结束
=>00 A4 00 04 02
<=A4
=>2F E2
<=61 19 //返回长度0x19
=>00 C0 00 00 19 //读取0x19的fcp数据
<=C0 62178202412183022FE28A01058B032F06018002000A880110 9000
=>00 B0 00 00 06
<=B0 9868200B3261 9000 //90 00正常结束
=>00 A4 00 04 02
<=A4
=>2F E2
<=61 19 //返回长度0x19
=>00 C0 00 00 19 //读取0x19的fcp数据
<=C0 62178202412183022FE28A01058B032F06018002000A880110 9000
=>00 B0 00 00 01
<=B0 98 9000 //90 00正常结束
3.读取多于/00原有数据
当读B0时,解析fcp里面的内容可知B0长度为0A,但是却想读取更多的内容,如0x0B,或者读取长度为00,则会返回该文件的剩余大小6C开始,需要以实际大小来读取
=>00 A4 00 04 02
<=A4
=>2F E2
<=61 19 //返回长度0x19
=>00 C0 00 00 19 //读取0x19的fcp数据
<=C0 62178202412183022FE28A01058B032F06018002000A880110 9000
=>00 B0 00 00 0B
<=B0 6C 0A //6C 0A
4.异常情况
1.使用命令B2去读B0的数据
=>00 A4 00 04 02
<=A4
=>2F E2
<=61 19 //返回长度0x19
=>00 C0 00 00 19 //读取0x19的fcp数据
<=C0 62178202412183022FE28A01058B032F06018002000A880110 9000
=>00 B2 01 04 0B
<=B0 69 81 //命令与该文件结构不兼容
2.SIM PIN/PUK时,却想要读IMSI
=>00 A4 08 04 04
<=A4
=>7FFF6F07
<=61 19 //返回长度0x19
=>00 C0 00 00 19 //读取0x19的fcp数据
<=C0 62178202412183026F078A01058B036F060380020009880138 9000
=>00 B0 00 00 09
<=B0 69 82:不满足安全条件:
5.其他重要的B0文件
如PLMN相关的:
PLMNsel_USIM 6F30
HPPLMN_USIM 6F31
PLMNwACT_USIM 6F60
OPLMNwACT_USIM 6F61
HPLMNwACT_USIM 6F62
FPPLMN_USIM 6F7B
EHPLMN_USIM 6FD9
EHPLMNPI_USIM 6FDB
LRPLMNSI_USIM 6FDC
LOCI相关的:
LOCI_USIM 6F7E
EPSLOCI_USIM 6FE3
LOCIPS_USIM 6F73