Guten Tag zusammen,
ich versuche gerade verzweifelt, Daten auf eine I2C Smartcard zu
schreiben.
Ich habe folgende Karte:
http://www.chipdrive.de/index.php/de/chipkarten-kaufen/mifare-desfire-tags-rfid/chipdrive-memorycard-weiss-10er.htm
Und folgenden Kartenleser:
http://www.amazon.de/gp/product/B0008ENDV6/
Für den Kartenleser existiert eine DLL, die einen Zugriff über die
CT-API gestattet. Diese habe ich erfolgreich eingebunden. Wenn ich diese
mit folgendem Code aktiviere, bekomme ich als Antwort ein 0x90 0x00
zurück, das Aktivieren scheint also erfolgreich zu sein.
1 | sad=2; /* source = host */
|
2 | dad=1; /* destination = CardTerminal */
|
3 | lenr=MAXMEM; /* maximum response length as Info to the function */
|
4 | command[0]=0x20; /* CLA */
|
5 | command[1]=0x11; /* INS */
|
6 | command[2]=0x01; /* P1 */
|
7 | command[3]=0x00; /* P2 */
|
8 | command[4]=0x00; /* L */
|
9 | /* Call function (CT_data) */
|
10 | res=CT_data (ctn,&dad,&sad,5,command,&lenr,response);
|
Ich möchte nun ein einfaches WriteBinary absetzen und die Bytes 0xCA
0xFE in das Masterfile (welches ja standardmäßig ausgewählt ist?)
schreiben. Wenn ich das mit folgendem Code versuche, bekomme ich 0x6A
0x82 (File not Found) als Antwort.
1 | //Write Binary Command
|
2 | dad = 0;
|
3 | sad = 2;
|
4 | lenr = MAXMEM;
|
5 | command[0] = 0x00;
|
6 | command[1] = 0xD0;
|
7 | command[2] = 0x00;
|
8 | command[3] = 0x00;
|
9 | command[4] = 0x02;
|
10 | command[5] = 0xCA;
|
11 | command[6] = 0xFE;
|
12 | command[7] = 0x00;
|
13 |
|
14 | res=CT_data (ctn,&dad,&sad,8,command,&lenr,response);
|
Die gleiche Antwort bekomme ich auch, wenn ich ein ReadBinary absetze:
1 | // Read Binary Command
|
2 | dad = 0;
|
3 | sad = 2;
|
4 | lenr = MAXMEM;
|
5 | command[0] = 0x00;
|
6 | command[1] = 0xB0;
|
7 | command[2] = 0x00;
|
8 | command[3] = 0x00;
|
9 | command[4] = 0x00;
|
10 | res=CT_data (ctn,&dad,&sad,5,command,&lenr,response);
|
Hat hier vielleicht jemand eine Idee, was ich falsch mache? Wenn noch
Infos fehlen, einfach fragen.
Vielen Dank schonmal
MagpieGuy