加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
IC卡机操作命令集合.txt 7.26 KB
一键复制 编辑 原始数据 按行查看 历史
terry 提交于 2023-12-04 13:48 . +3
###声明:本次测试卡为:非接触式存储卡(M1),UID为 0A CD FC 86。(03扇区已进行过实验,密钥A已修改为010203040506)
#1 测试读取卡类型操作
[10:36:47.037]发→◇02 00 02 30 12 22 00 03 □//读取卡类型
[10:36:47.058]收←◆02 00 04 00 00 01 03 02 03
tips:返回4个字节,前2个字节代表命令执行成功,第3个字节0x01为卡座有卡状态,第4个字节0x03为M1卡类型。
#2 测试激活非接触式存储卡操作
[10:39:22.551]发→◇02 00 02 32 11 23 00 03 □//激活非接触式存储卡
[10:39:22.595]收←◆02 00 07 00 00 00 0A CD FC 86 BD 03
tips:返回7个字节,前2个字节代表命令执行成功,第3个字节0x00为M1卡类型(0x01为CPU卡),第4-7个字节为卡的UID码。
#3 测试读写块操作(00扇区、01扇区)
1.读写之前需对操作的扇区进行密码校验。
[10:43:05.521]发→◇02 00 0A 32 12 00 00 FF FF FF FF FF FF 20 03 □//通过密钥A进行密码校验(1字节扇区号+1字节密码类型(0x00为密钥A,0x01为密钥B))
[10:43:05.551]收←◆02 00 02 00 00 00 03
tips:校验00扇区,默认密码A为6字节FF。返回2个字节,为命令执行成功。
2.读取00扇区0-3块操作。
[10:45:40.056]发→◇02 00 03 32 13 00 21 03 □//读00扇区00块
[10:45:40.099]收←◆02 00 12 00 00 0A CD FC 86 BD 08 04 00 62 63 64 65 66 67 68 69 0C 03 //返回UID以及厂家内容
tips:读取00扇区00块,返回18字节。前2字节为命令执行成功,后16字节为00扇区00块内容。
[10:47:59.852]发→◇02 00 03 32 13 01 20 03 □//读00扇区01块
[10:47:59.892]收←◆02 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
[10:48:30.298]发→◇02 00 03 32 13 02 23 03 □//读00扇区02块
[10:48:30.339]收←◆02 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
[10:48:45.396]发→◇02 00 03 32 13 03 22 03 □//读00扇区03块(00扇区最后一个区块)
[10:48:45.433]收←◆02 00 12 00 00 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF 11 03
tips:返回18字节,除前2字节为命令执行成功外,后16字节为:前6字节为密钥A(若本扇区通过密钥A认证,则该区域禁读可写。通过密钥B则禁止)
第9-12字节为存取控制位(密钥A可读可写,密钥B禁止)。最后6个字节为密钥B(密钥A禁止,密钥B禁读可写)。
3.写入01扇区4-7块操作(4:时间,5:公司名称,6:写卡人,7:为密钥区域不可写入)
[10:58:46.641]发→◇02 00 0A 32 12 01 00 FF FF FF FF FF FF 21 00 03 □//01扇区密码认证操作
[10:58:46.670]收←◆02 00 02 00 00 00 03
[10:59:40.161]发→◇02 00 03 32 13 04 25 03 □//读取04区块(归属01扇区)
[10:59:40.200]收←◆02 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
[11:00:09.766]发→◇02 00 03 32 13 05 24 03 □//读取05区块(归属01扇区)
[11:00:09.808]收←◆02 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
[11:00:26.318]发→◇02 00 03 32 13 06 27 03 □//读取06区块(归属01扇区)
[11:00:26.359]收←◆02 00 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03
[11:00:44.296]发→◇02 00 03 32 13 07 26 03 □//读取07区块(归属01扇区)
[11:00:44.336]收←◆02 00 12 00 00 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF 11 03
[11:02:51.854]发→◇02 00 13 32 14 04 32 30 32 33 31 32 30 34 31 31 30 31 00 00 00 00 27 03 □//写入04区块:202312041101
[11:02:51.896]收←◆02 00 02 00 00 00 03
[11:04:38.977]发→◇02 00 03 32 13 04 25 03 □//再次读取04区块(归属01扇区)
[11:04:39.013]收←◆02 00 12 00 00 32 30 32 33 31 32 30 34 31 31 30 31 00 00 00 00 05 03 //写入成功
[11:06:33.469]发→◇02 00 13 32 14 05 48 61 6E 67 7A 68 6F 75 20 4A 69 61 6C 6F 6E 67 63 03 □//写入05区块:Hangzhou Jialong
[11:06:33.505]收←◆02 00 02 00 00 00 03
[11:08:07.733]发→◇02 00 03 32 13 05 24 03 □//再次读取05区块(归属01扇区)
[11:08:07.769]收←◆02 00 12 00 00 48 61 6E 67 7A 68 6F 75 20 4A 69 61 6C 6F 6E 67 40 03 //写入成功
[11:09:57.389]发→◇02 00 13 32 14 06 46 72 6F 6D 20 5A 41 43 4B 00 00 00 00 00 00 00 25 03 □//写入05区块:From ZACK
[11:09:57.425]收←◆02 00 02 00 00 00 03
[11:10:36.635]发→◇02 00 03 32 13 06 27 03 □//再次读取06区块(归属01扇区)
[11:10:36.672]收←◆02 00 12 00 00 46 72 6F 6D 20 5A 41 43 4B 00 00 00 00 00 00 00 05 03 //写入成功
#4 测试读值写值操作(02扇区8-11)
tips:读值、加值、减值,前提是目标块的数据符合值块的格式。也就是目标块已初始化过值(需要先进行写值操作)
[11:20:23.674]发→◇02 00 0A 32 12 02 00 FF FF FF FF FF FF 22 03 □//02扇区密码认证操作
[11:20:23.700]收←◆02 00 02 00 00 00 03
[11:34:23.385]发→◇02 00 07 32 16 08 64 00 00 00 48 03 □//写入00 00 00 64值块
[11:34:23.412]收←◆02 00 02 00 00 00 03
[11:35:47.888]发→◇02 00 03 32 15 08 2F 03 □//读取08值块
[11:35:47.915]收←◆02 00 06 00 00 64 00 00 00 64 03
[11:35:47.915]发→◇02 00 03 32 13 08 29 03 □//读取08区块(归属02扇区)
[11:36:28.617]收←◆02 00 12 00 00 64 00 00 00 9B FF FF FF 64 00 00 00 08 F7 08 F7 64 03
tips:返回18字节,前2字节为执行成功,3-6为写入值块原码,7-10为写入值块的16进制(按位取反),11-14为写入值块原码,
15-18:0x08存取值块的地址,0xF7为地址取反,后边相同(共2次取反2次不取反)。
#5 测试加值减值操作(02扇区8-11)
加值:
[13:10:30.380]发→◇02 00 07 32 17 08 01 00 00 00 2C 03 □//加值01到08值块
[13:10:30.406]收←◆02 00 02 00 00 00 03
[13:12:21.850]发→◇02 00 03 32 15 08 2F 03 □//读取08值块
[13:12:21.876]收←◆02 00 06 00 00 65 00 00 00 65 03
[13:13:09.950]发→◇02 00 03 32 13 08 29 03 □//读取08区块(归属02扇区)
[13:13:09.985]收←◆02 00 12 00 00 65 00 00 00 9A FF FF FF 65 00 00 00 08 F7 08 F7 65 03
减值:
[13:14:41.164]发→◇02 00 07 32 18 08 02 00 00 00 20 03 □//减值02到08值块
[13:14:41.190]收←◆02 00 02 00 00 00 03
[13:15:43.094]发→◇02 00 03 32 15 08 2F 03 □//读取08值块
[13:15:43.120]收←◆02 00 06 00 00 63 00 00 00 63 03
[13:16:00.943]发→◇02 00 03 32 13 08 29 03 □//读取08区块(归属02扇区)
[13:16:00.981]收←◆02 00 12 00 00 63 00 00 00 9C FF FF FF 63 00 00 00 08 F7 08 F7 63 03
#6 测试修改密码操作(03扇区12-15)
1.进行03扇区认证
[13:21:12.753]发→◇02 00 0A 32 12 03 00 FF FF FF FF FF FF 23 03 □//03扇区密码认证操作
[13:21:12.779]收←◆02 00 02 00 00 00 03
2.读取原始信息
[13:22:02.045]发→◇02 00 03 32 13 0F 2E 03 □//读取第15区块
[13:22:02.077]收←◆02 00 12 00 00 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF 11 03
3.修改密码(密码A)
[13:23:34.434]发→◇02 00 0A 32 19 03 00 01 02 03 04 05 06 2F 03 □//修改密码010203040506
[13:23:34.460]收←◆02 00 02 00 00 00 03
4.检验是否成功
[13:24:51.570]发→◇02 00 0A 32 12 03 00 01 02 03 04 05 06 24 03 □//认证扇区
[13:24:51.596]收←◆02 00 02 00 00 00 03 //认证通过
[13:25:52.120]发→◇02 00 03 32 13 0F 2E 03 □//可再次读取第15区块
[13:25:52.156]收←◆02 00 12 00 00 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF 11 03
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化