新手入门
- 积分
- 11
- 金钱
- 11
- 注册时间
- 2018-5-26
- 在线时间
- 2 小时
|
uint16_t PcdExAuth(uint8_t keysign, uint8_t *pRan)
{
uint8_t status = MI_ERR;
uint32_t unLen;
uint8_t ucComMF522Buf[MAXRLEN];
uint16_t ErrCode = 0x9000;
debug_data(">>>>pRan:", pRan, 8);
memset(ucComMF522Buf, 0x00, MAXRLEN);
PcdSwitchPCB();
ucComMF522Buf[0] = Pcb;
ucComMF522Buf[1] = 0x01;
ucComMF522Buf[2] = 0x00;
ucComMF522Buf[3] = 0x82;
ucComMF522Buf[4] = 0x00;
ucComMF522Buf[5] = keysign; //认证的密码标识号
ucComMF522Buf[6] = 0x08;
ucComMF522Buf[7] = pRan[0]; //8个字节的随机数
ucComMF522Buf[8] = pRan[1];
ucComMF522Buf[9] = pRan[2];
ucComMF522Buf[10] = pRan[3];
ucComMF522Buf[11] = pRan[4];
ucComMF522Buf[12] = pRan[5];
ucComMF522Buf[13] = pRan[6];
ucComMF522Buf[14] = pRan[7];
CalulateCRC(ucComMF522Buf, 15, &ucComMF522Buf[15]); // 生成发送内容的CRC校验,保存到最后两个字节
status = PcdComMF522(PCD_TRANSCEIVE, ucComMF522Buf, 17, ucComMF522Buf, &unLen);// 将收到的卡片类型号保存
debug_data("PcdExAuth:", ucComMF522Buf, 8);
if (status == MI_OK)
{
ErrCode = ((ucComMF522Buf[2] << 8) | ucComMF522Buf[3]);
}
else
{
ErrCode = 0xffff;
}
return ErrCode;
}
CPU卡外部认证过程中,执行到获取随机数,加密随机数,去执行外部认证失败,急!!!
|
|