00-个人化.txt 6.86 KB
clear
//卡片复位
RESET 
//选择card manager
00A4040000
//GP认证
jcop22_ext_auth 0, 404142434445464748494a4b4c4d4e4f, 404142434445464748494a4b4c4d4e4f, 404142434445464748494a4b4c4d4e4f
80E4 0000 12 4F 10 D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3 
//安装本地应用
call sendcmd(80E6 0C00 28 06A00000033302 07A0000003330202 10 D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3 010404C902400000)
//卡片复位
RESET 
//选择应用
call sendcmd(00 A4 04 00 10 D6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3)
//校验认证码
call sendcmd(80 2A 00 00 10 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) 
//创建MF
call sendcmd(80 E0 00 00 19 3F00FFFFAAAA0108FFD6C7D0C5C8DAB4B4D4B0C7F8D3A6D3C3) 
//创建密钥文件
call sendcmd(80 E0 02 00 0B 1E 0000 0090 EFAA 00 30 FF FF) 
//主控密钥3900
call sendcmd(80D4010015 39F0F0330A FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0) 
//内部认证密钥3001
call sendcmd(80D401011530F0AA0101 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) 
//内部认证密钥3002
call sendcmd(80D401021530F0AA0101 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) 
//内部认证密钥3003
call sendcmd(80D4010315 30F0AA0101 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) 
//维护密钥3601
call sendcmd(80D4010115 36F0F03301 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4) 
//维护密钥3602
call sendcmd(80D401021536F0F03301 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF4) 

//创建dir变长记录文件0001
call sendcmd(80E0 0200 0B 02 0001 0050 F0F0 01 21 FF FF) 
call sendcmd(00DC 010C 32 70 30 61164F08B5D8C0FBD4DACFDF500A11111111111111111111 61164F08B5D8C0FBC7AEB0FC500A22222222222222222222) 
//创建应用基本信息文件0005
call sendcmd(80E0 0200 0B 00 0005 00FA F0F0 05 21 00 FF) 
//写0005文件 卡面号6/卡类型编码8/发卡机构编码10/RFU 226
call sendcmd(00D6 8500 18 888870000001 313030303031FFFF 38383838FFFFFFFFFFFF) 
//创建保留文件0006
call sendcmd(80E0 0200 0B 00 0006 00FA F0F0 06 22 FF FF) 

//创建DF01
call sendcmd(80E0 0100 11 DF01 07FF AAAA 9508 FF B5D8C0FBD4DACFDF) 
//选择DF01
call sendcmd(00A4 0400 08 B5D8C0FBD4DACFDF)
//创建密钥文件s
call sendcmd(80 E0 02 00 0B 1E 0000 0200 EFAA 00 30 FF FF) 
//主控密钥3900
call sendcmd(80D4010015 39F0F0330A FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF6) 
//外部认证密钥3901
call sendcmd(80D4010115 39F0EE3301 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7) 
//维护密钥3601
call sendcmd(80D401011536F0F03301 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8) 
//维护密钥3602
call sendcmd(80D401021536F0F03301 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8) 
//创建应用基本信息文件0015
call sendcmd(80E0 0200 0B 00 0015 00FA F1F0 15 21 00 FF) 
//创建应用基本信息文件0016
call sendcmd(80E0 0200 0B 00 0016 00FA F0F0 16 22 00 FF) 
//本地特色应用记录文件0019 
call sendcmd(80E0 0200 0B 02 0019 0119 F0F0 19 22 FF FF) 
//创建DF02
call sendcmd(80E0 0100 11 DF02 07FF AAAA 9508 FF B5D8C0FBC7AEB0FC) 
//选择DF02
call sendcmd(00A4 0400 08 B5D8C0FBC7AEB0FC)
//创建密钥文件
call sendcmd(80 E0 02 00 0B 1E 0000 0200 EFAA 00 30 FF FF) 
//主控密钥3900
call sendcmd(80D401001539F0F0330A 88888888888888888888888888888888) 
//结束个人化
call sendcmd(800A000000)

End


sendcmd:
	prompt off
	cmd = getpara()
	expect = getpara()
	expectlen = datalen($expect)	
	prompt on
	
	sendtext $cmd
	prompt off
	set result[0]
	prompt on
	if $expectlen==0000
		if sw != 9000
			message"发送指令失败,预期返回:9000,实际返回:" $sw
			pause
		endif
	else if $expectlen==0002
		if sw != $expect
			message"返回数据与预期不一致,预期返回:" $expect "实际返回:" $sw
			pause
		endif
	else
		prompt off
		expectlen = sub($expectlen,02)
		expectdata = hleft($expect,$expectlen)
		expectsw = right($expect,02)
		prompt on
		if $result[0] != $expectdata
			message"返回数据与预期不一致,预期返回:" $expectdata "实际返回:" $result[0]
			pause
		endif
		if sw != $expectsw
			message"返回数据与预期不一致,预期返回:" $expectsw "实际返回:" $sw
			pause
		endif
	endif
return