Hello,
it worked at least !!
>>I believe this card is 7816 compliant. You should try to send the
>>command without the 0x03 in the end. I think the Towitoko driver
>>expects
>>you to send a TPDU (i.e. transport level commands for T=0 and not
>>applicative level commands (APDU)). It therefore ignores the final
>>0x03.
>Maybe the wording in the card documentation is ambiguous and the 0x03
>should not be added?
You were right. The documentation does not seem to be ok. I did not add
the 0x03 at the end of the command and it worked. The driver issued the
GetResponse() command automatically and everything worked properly.
The dump of the relevant command now looks like this:
-> pcsc_create_dir_crycs() returned 0x0:
[CMD] [ 0x84 0xE0 0x01 0x00 0x0F 0x10 0x00 0x38 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x14 0x15 0x6A 0x00 ]
[RSP] [ 0x40 0xCB 0xDC 0x90 0x00 ]
response: 0x40 0xCB 0xDC
crycks: 0x40 0xCB 0xDC
OK
It seems that the towitoko driver works at the TPDU level and ignores
the Le field at the end. So this did not matter ?!
� That means that on the APDU level the driver always issues the
GetResponse() command automatically when it receives a return value of
0x61XX ?
But if that is true then I do not understand why the following
GetResponse commands still *did* work:
-> pcsc_select_file_key() returned 0x0:
[CMD] [ 0x80 0x28 0x00 0x01 0x08 0x00 0x01 0x02 0x03 0x04 0x00 0x06 0x07 ]
[RSP] [ 0x61 0x0C ]
-> pcsc_get_response() returned 0x0:
[CMD] [ 0x00 0xC0 0x00 0x00 0x0C ]
[RSP] [ 0x8C 0xAF 0xAE 0x87 0x00 0x01 0x02 0x03 0x18 0x9B 0xB7 0xEC 0x90
0x00 ]
OK
Why does the driver accept one time the GetResponse() command by the
programm one time, and does issue it itself another time?
� Another question arises:
> In fact, for a case 4 command (Data IN and OUT), the proper APDU is
> CLA, INS, P1, P2, Lc, Data, Le.
> The Get Response is a transport level command used in the T=0
protocol > (it does not exist in T=1) and the application should ideally
not have > to send it.
In my special case I did not send a proper APDU since the Le field at
the end was not added. Why does the driver issue the GetResponse()
command then automatically it is supposed to work at the APDU level?
Here is the code:
-> pcsc_create_dir_crycs() returned 0x0:
[CMD] [ 0x84 0xE0 0x01 0x00 0x0F 0x10 0x00 0x38 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x00 0x00 0x14 0x15 0x6A 0x00 ]
[RSP] [ 0x40 0xCB 0xDC 0x90 0x00 ]
> There is a bit of ambiguity about how the driver should work for T=0
> cards. To be strictly ISO 7816 compliant the driver should accept
> APDU's: issue Get Response (and Envelope) automatically, etc. But to
> > be
> compliant with PCSC (and with most applications, like Musclecard), the
> driver must better work with TPDU's. That's why my driver offers both
> possibilities.
>
> In general I aggree with Jean Luc that all the drivers should present
> an APDU level interface. But that would mean to change things in PCSC.
> musclecard, and other applications that assume that they work at TPDU
> level.
So should I better use TPDU's conform commands or APDU conform commands
for PCSC? For me everything is quite confusing and sometimes even
contradictory.
Regards,
Arno Wilhelm
P.S.: I add the dump of the programm again.
--
_ __ ___ _ _ _
/_\ _ _ _ _ ___ \ \ / (_) | |_ ___| |_ __
/ _ \| '_| ' \/ _ \ \ \/\/ /| | | ' \/ -_) | ' \
/_/ \_\_| |_||_\___/ \_/\_/ |_|_|_||_\___|_|_|_|_|
tel://+43/512/394545/72
fax://+43/512/394545/20
mail:[EMAIL PROTECTED]
http://www.phion.com
root@geaeini: pcsc> ./PCSC 1
Reader = 1
-> pcsc_init(reader):
READER: Gemplus GemPC410 Reader - libGemPC410 0 0
ATR: 3B A7 00 40 18 80 65 A2 08 01 01 52
LENGTH: 12
Found the GPK-8000 card from Gemplus.
OK
-> pcsc_erase_card() returned 0x0:
[CMD] [ 0xDB 0xDE 0x00 0x00 ]
[RSP] [ 0x90 0x00 ]
OK
-> pcsc_select_file() returned 0x0:
[CMD] [ 0x00 0xA4 0x00 0x0C 0x02 0x3F 0x00 ]
[RSP] [ 0x90 0x00 ]
OK
-> pcsc_select_file_key() returned 0x0:
[CMD] [ 0x80 0x28 0x00 0x01 0x08 0x00 0x01 0x02 0x03 0x04 0x00 0x06 0x07 ]
[RSP] [ 0x61 0x0C ]
-> pcsc_get_response() returned 0x0:
[CMD] [ 0x00 0xC0 0x00 0x00 0x0C ]
[RSP] [ 0x8C 0xAF 0xAE 0x87 0x00 0x01 0x02 0x03 0x18 0x9B 0xB7 0xEC 0x90 0x00 ]
OK
-> pcsc_create_dir_crycs() returned 0x0:
[CMD] [ 0x84 0xE0 0x01 0x00 0x0F 0x10 0x00 0x38 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x14 0x15 0x6A 0x00 ]
[RSP] [ 0x40 0xCB 0xDC 0x90 0x00 ]
response: 0x40 0xCB 0xDC
crycks: 0x40 0xCB 0xDC
OK
-> pcsc_select_file() returned 0x0:
[CMD] [ 0x00 0xA4 0x01 0x00 0x02 0x10 0x00 ]
[RSP] [ 0x61 0x12 ]
OK
-> pcsc_get_response() returned 0x0:
[CMD] [ 0x00 0xC0 0x00 0x00 0x12 ]
[RSP] [ 0x85 0x10 0xC1 0x02 0x10 0x00 0x38 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x70 0x90 0x00 ]
OK
-> pcsc_create_file() returned 0x0:
[CMD] [ 0x80 0xE0 0x02 0x00 0x0C 0x10 0x01 0x2C 0x00 0x00 0x94 0x00 0x00 0x00 0x00
0x00 0x00 ]
[RSP] [ 0x90 0x00 ]
OK
-> pcsc_apd_rec() returned 0x0:
[CMD] [ 0x00 0xE2 0x00 0x08 0x07 0x00 0x11 0x00 0x00 0x00 0x00 0xB4 ]
[RSP] [ 0x90 0x00 ]
OK
-> pcsc_create_private_key_file() returned 0x0:
[CMD] [ 0x80 0x12 0x01 0x57 ]
[RSP] [ 0x90 0x00 ]
OK
-> pcsc_select_file() returned 0x0:
[CMD] [ 0x00 0xA4 0x02 0x00 0x02 0x10 0x01 ]
[RSP] [ 0x61 0x12 ]
OK
-> pcsc_get_response() returned 0x0:
[CMD] [ 0x00 0xC0 0x00 0x00 0x12 ]
[RSP] [ 0x85 0x10 0x42 0x01 0x10 0x01 0x2C 0x00 0x00 0x94 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x6D 0x90 0x00 ]
OK
-> pcsc_generate_rsa_key() returned 0x0:
[CMD] [ 0x80 0xD2 0x81 0x11 ]
[RSP] [ 0x90 0x00 ]
OK
-> pcsc_get_response() returned 0x0:
[CMD] [ 0x00 0xC0 0x00 0x00 0x82 ]
[RSP] [ 0x90 0x00 0x5B 0xB7 0x69 0x1A 0x0A 0xBA 0x40 0xC1 0xBC 0x6F 0xF7 0x12 0x72
0x12 0xB2 0xB8 0xBC 0x97 0xA8 0x77 0x9A 0x40 0x7B 0x10 0xA0 0xC4 0x76 0x5E 0xB0 0x6E
0x4A 0x00 0x9D 0xB0 0x63 0x26 0x0C 0xD8 0xB8 0xE1 0xFE 0x00 0xFE 0xEB 0xBB 0x19 0xB8
0x74 0x54 0x7C 0xE8 0xFC
0x22 0xAE 0xF4 0xAC 0x67 0x5C 0x01 0xA8 0x92 0x2B 0xE0 0xBD 0xBE 0x22 0xE9 0x7C 0x73
0x55 0x73 0x27 0xC8 0xD1 0x64 0x54 0x90 0x0A 0x3F 0xD9 0x88 0xF5 0xA7 0x15 0x6D 0x33
0xE2 0xE6 0xD5 0x9E 0xF2 0x75 0x6D 0xCE 0xDB 0x02 0x15 0x42 0xA6 0xD0 0x52 0x41 0xE7
0x11 0x3F 0xD5 0xD7 0xCA 0xDF 0x97 0xBE 0x39 0x49 0x37 0xBB 0xE6 0xE9 0x9D 0x9E 0xBD
0x26 0x56 0x36 0x3E 0x59 0x0C 0xD3 0xD3 0x90 0x00 ]
OK
-> pcsc_pk_dir() returned 0x0:
[CMD] [ 0x80 0xA0 0x00 0x00 0x03 ]
[RSP] [ 0x01 0x00 0x94 0x90 0x00 ]
OK
SFID = 0x01; Length = 148
-> pcsc_sel_crypto_context() returned 0x0:
[CMD] [ 0x80 0xA6 0x01 0x31 ]
[RSP] [ 0x90 0x00 ]
OK
-> pcsc_init_hashed_data() returned 0x0:
[CMD] [ 0x80 0xEA 0x00 0x00 0x10 0x39 0x33 0x32 0x32 0x31 0x35 0x37 0x62 0x64 0x36
0x61 0x37 0x37 0x35 0x35 0x30 ]
[RSP] [ 0x90 0x00 ]
OK
-> pcsc_pk_int_aut() returned 0x0:
[CMD] [ 0x80 0x88 0x00 0x00 0x80 ]
[RSP] [ 0xE4 0x22 0x1E 0xA6 0x82 0x63 0xDD 0x40 0x2F 0xE3 0xE8 0xFB 0x77 0x75 0x50
0xCF 0xF6 0x1E 0xAC 0x57 0xDB 0xAF 0x8A 0xD2 0x7C 0x37 0x4C 0x6D 0xC7 0x5F 0x39 0x07
0x7A 0x47 0x96 0x46 0xA9 0x16 0x56 0x27 0x0C 0x92 0xA2 0x8D 0x4B 0x61 0xF1 0x3D 0x78
0xE4 0xAF 0x74 0xFE 0xA5
0x3C 0xEA 0x2A 0x6E 0x4B 0xE0 0xFA 0x9A 0x15 0x79 0xA1 0x56 0x92 0x7A 0xC6 0xAE 0xBB
0x3E 0x77 0xBE 0x76 0x87 0x8E 0x33 0x3F 0xB5 0x68 0xDB 0xBA 0x9D 0xEE 0x15 0x06 0x98
0xF4 0xB2 0xD0 0xFB 0xB7 0x17 0x0F 0x36 0xCF 0x37 0x40 0x58 0xF8 0xC8 0x3C 0x23 0xD1
0x29 0x27 0xBD 0x76 0x37 0xA7 0x36 0x2E 0x4E 0x77 0x10 0x03 0xCF 0x10 0xA7 0xBA 0x60
0x2A 0x7D 0xC2 0x61 0x2D 0x62 ]
pc/sc error: Unknown internal error.
-> pcsc_release():
OK
root@geaeini: pcsc>