输出项目:RetData=0x00操作成功;RetData=0xFF此操作失败。
unsigned char EsamChipAuthentication(unsigned char CpuFiled,unsigned char EsamFiled) { unsigned char i,Ret; unsigned char Temp[8]; //从ESAM模块取随机数 Ret = CosReset(0); if(Ret != 0) { return 0x01; } Ret = Getchanllege(0,8); if(Ret != 0) { return 0x02; } for(i = 0; i < 8; i++) { Temp = CosBuf; } //把随机数送CPU卡加密 for(i = 0; i < 8; i++) { CmdBuf[i + 5] = Temp; } CmdBuf[13] = 8;//-----------------------------------------------------------Le Ret = Internalauthen(1,CpuFiled); if(Ret != 0) { return 0x03; } for(i = 0; i < 8; i++) { CmdBuf[i + 5] = CosBuf; } Ret = Externalauthen(0,EsamFiled); if(Ret == 0) { return 0x00; } else { return 0x04; } }