ACS ACR83 PINeasy Smart Card Reader User Manual

Page 46

Advertising
background image

ACR83 – Reference Manual

[email protected]

Version 1.05

www.acs.com.hk

Page 46 of 49

printf("Error: not enough memory\n");

exit(1);

}

// Initialize PIN verify structure (ACOS3)

pPinVerify->bTimeOut = 0;

pPinVerify->bTimeOut2 = 0;

pPinVerify->bmFormatString = 0;

pPinVerify->bmPINBlockString = 0x08;

pPinVerify->bmPINLengthFormat = 0;

pPinVerify->wPINMaxExtraDigit = 0x0408;

pPinVerify->bEntryValidationCondition = 0x03;

pPinVerify->bNumberMessage = 0x01;

pPinVerify->wLangId = 0x0409;

pPinVerify->bMsgIndex = 0;

pPinVerify->bTeoPrologue[0] = 0;

pPinVerify->bTeoPrologue[1] = 0;

pPinVerify->bTeoPrologue[2] = 0;

pPinVerify->ulDataLength = dwSendBufferLen;

memcpy(pPinVerify->abData, bSendBuffer, dwSendBufferLen);

// Verify PIN

printf("Verifying PIN using VERIFY_PIN_DIRECT...\n");

dwRecvBufferLen = sizeof(bRecvBuffer);

lReturn = SCardControl(hCard,

featureControlCodes[FEATURE_VERIFY_PIN_DIRECT],

pPinVerify, sizeof(PIN_VERIFY_STRUCTURE) - 1 + dwSendBufferLen,

bRecvBuffer, dwRecvBufferLen, &dwRecvBufferLen);

if (lReturn != SCARD_S_SUCCESS)

printf("Error: SCardControl failed with error 0x%08x\n",

lReturn);

else

{

printf("Response: ");

for (i = 0; i < dwRecvBufferLen; i++)

printf("%02X ", bRecvBuffer[i]);

printf("\n");

}

delete [] ((BYTE*) pPinVerify);

// Send card command for PIN modification (ACOS3)

dwSendBufferLen = 13;

memcpy(bSendBuffer,

"\x80\x24\x00\x00\x08\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF", dwSendBufferLen);

// Create PIN modify structure

PPIN_MODIFY_STRUCTURE pPinModify = (PPIN_MODIFY_STRUCTURE) new

BYTE[sizeof(PIN_MODIFY_STRUCTURE) - 1 + dwSendBufferLen];

if (pPinModify == NULL)

{

printf("Error: not enough memory\n");

exit(1);

}

// Initialize PIN modify structure (ACOS3)

pPinModify->bTimeOut = 0;

pPinModify->bTimeOut2 = 0;

pPinModify->bmFormatString = 0;

pPinModify->bmPINBlockString = 0x08;

Advertising