金融IC卡在申请联机交易时,终端会进行发卡行认证,验证卡片的合法性,终端通过GAC得到卡片返回的ARQC,与终端自身产生的ARQC进行比较,如果一致,则说明是由发卡行发行的合法卡片,同时对ARQC及认证码进行3DES计算,返回ARPC,卡片得到ARPC后进行外部认证,用以验证终端的合法性。文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
计算ARQC的步骤为:文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
1.发送GAC文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
2.利用应用主密钥(ARQC KEY即DGI8000前16字节)对ATC前补000000000000与ATC的反前补000000000000拼接的数据(如ATC为0001,则这里是0000000000000001000000000000FFFE)做3DES加密算出过程密钥SKAC,文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
3.组织数据授权金额至不可预知数(TAG 9F49的值,动态数据认证时发内部认证的数据),加上AIP、ATC、卡片验证结果补80,文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
4.用过程密钥SKAC对上述组织的数据进行MAC计算即可得到ARQC的值举例如下:文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
1.终端发送GAC:80AE8000340000000012340000000000340156D86004A800015612051601010101010903200000000000000000000000000000000000000000文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
卡片返回:801E80000EF294D7022FA9B05807020103A4B904010A0100000000001BFC423C文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
卡片应用子密钥(DGI8000前16字节):0D2E3CB0BC1F9E03AED58F663A2F9679文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
可知ATC=000E ARQC=F294D7022FA9B058 卡片验证结果为:03A4B904 AIP:7C00文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
2.用卡片应用子密钥0D2E3CB0BC1F9E03AED58F663A2F9679对000000000000000E000000000000FFF1做3DES加密得到过程密钥SKAC:C3D3F062E9992B4E923D338D66193526文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
3.从GAC返回数据及AIP等进行数据组织:0000000012340000000000340156D86004A80001561205160101010101+7C00+000E+03A4B904+800000文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
4.用SKAC对上述数据做PBOCMac计算得到:F294D7022FA9B058文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
ARPC的计算过程相对简单:文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
1.将ARQC与服务码+6字节0进行异或文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
2.用计算ARQC的过程密钥对异或结果进行3DES加密(过程密钥与上述ARQC计算相同)即为ARPC文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
3.卡片利用终端返回的ARPC+服务码进行外部认证文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
举例如下:文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
采用上述GAC返回的ARQC:F294D7022FA9B058文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
1.F294D7022FA9B058和3030000000000000异或C2A4D7022FA9B058文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
2.用C3D3F062E9992B4E923D338D66193526进行3DES加密得到结果ARPC:3846EEB4C8D34271文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
3.外部认证:008200000A 3846EEB4C8D34271 3030文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html
文章来源:SingCard的博客文章源自堕落的鱼-https://www.duoluodeyu.com/2313.html