KOBIL Smart Card Terminal Manual
Page
34
/* issue response */
for
(i=0;i<lenr;i++)
printf("%02x ",response[i]);
printf("\nPlease insert card and press button!\n");
getch();
/*
RESET
ICC */
sad = 2; /*
source = Host (PC)
*/
dad = 1; /*
destination = CardTerminal */
lenr =
sizeof
(response); /* maximum length of response */
command[0] = 0x20; /*
CLA
*/
command[1] = 0x12; /*
INS
*/
command[2] = 0x01; /*
P1
*/
command[3] = 0x01; /*
P2
*/
command[4] = 0x00; /*
LEN
*/
printf("Reset ICC return code:%d\nSW1-SW2:", CT_data(ctn, &dad,
&sad, 5, command, &lenr, response));
for
(i=0;i<lenr;i++)
printf("%02x ",response[i]);
/* READ BINARY */
printf("\n\nKVK Data:\n");
sad = 2;
/*
source = Host (PC)
*/
dad = 0;
/*
destination = card
*/
lenr =
sizeof
(response); /* maximum length of response */
command[0] = 0x00;
/* CLA */
command[1] = 0xb0;
/* INS */
command[2] = 0x00;
/* P1 */
command[3] = 0x00;
/* P2 */
command[4] = 0x00;
/* Le */
printf("Read binary return code:%d\nData:",CT_data(ctn, &dad,
&sad, 5, command, &lenr, response));
for
(i=0;i<lenr;i++)
printf("%02x ",response[i]);
/* DEACTIVATE ICC */
sad = 2; /*
source = HOST
*/
dad = 1; /*
destination = CardTerminal */
lenr =
sizeof
(response); /* maximum length of response */
command[0] = 0x20; /*
CLA
*/
command[1] = 0x14; /*
INS
*/
command[2] = 0x01; /*
P1
*/
command[3] = 0x00; /*
P2
*/
printf("\n\nDeactivate return code:%d\nSW1-SW2:",CT_data(ctn,
&dad, &sad, 4, command, &lenr, response));
for
(i=0;i<lenr;i++)
printf(" %02x ", response[i]);
/*
Close interface
*/
printf("\nCT_close return code:%d\n",CT_close(ctn));
printf("\nRemove Card!");
return
(0);
}