Hello Jean-Luc,
> If you look at your command, the length byte you send is wrong (it should be 0x10).
>Normally, I think the driver would unterstand your command as a fully qualified APDU
>(ie CLA, INS, P1,P2, Lc, Data, Le) and issue the Get Response automatically. The
>response you read could be the first 2 bytes of a 5 bytes answer (3 bytes of Data
>SW).
>
> -> pcsc_create_dir_crycs() returned 0x0:
> [CMD] [ 0x84 0xE0 0x01 0x00 0x0F 0x10 0x00 0x38 0x00 0x00 0x00 0x00 0x00 0x00 0x00
>0x00 0x00 0x8F 0x03 0xE5 0x03 ]
> [RSP] [ 0x78 0x1E ]
> Error: pcsc_create_dir_crycs() no checksum to read !
Normally I would agree with you: the data length is 0x10! But the GPK
reference manual is quite contradictory about the how the Lc byte has to
be interpreted. First it says that it "specifies the length of the data
send with the command in bytes" - this would conform to your opinion.
But when it gets more into detail it says that it is minimum 12 ( when
no name is given ) plus 3 bytes for the checksum ( "a value of 03h
should be added if secure messaging is used" ). This means that the 0x03
( lenght of checksum ) at the end of the command does not belong to the
data and does therefore not have to show up in the Lc field.
I tried to verify this and set the Lc field to 0x10 and got a return
value of 0x67 0x00 which means: "Incorrect length or address range
error" ( Driver: TOWITOKO_CHIPDRIVE_MICRO ).
It is also strange that the Towitoko driver does not seem to have any
problems with this command and returns the awaited response whereas both
drivers for the GemPC reader return some strange data, that does not
seem to be related to any documented return values. I am not so deep
into smartcard programming, but for me it still seems to be related to
the reader/driver. Or the GPK card might not be ISO7816 conform?
> I think the driver would unterstand your command as a fully qualified
> APDU (ie CLA, INS, P1,P2, Lc, Data, Le) and issue the Get Response
> automatically. The response you read could be the first 2 bytes of a
5 > bytes answer (3 bytes of Data SW).
I have not found any hint in the GPK Reference Manual that the card can
return a response without having issued the GetResponseCommand() before.
And I do not think that the driver should give the response instead of
the card?
I also cannot understand then why the towitoko driver does return a
valid response 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 0x83 0xDF 0x2C 0x03 ]
[RSP] [ 0x61 0x03 ]
-> pcsc_get_response() returned 0x0:
[CMD] [ 0x00 0xC0 0x00 0x00 0x03 ]
[RSP] [ 0x60 0x09 0x59 0x90 0x00 ]
OK
Regards,
Arno Wilhelm
P.S.: I include the output of the programm with the Lc field changed to
0x10 as you suggested.
--
_ __ ___ _ _ _
/_\ _ _ _ _ ___ \ \ / (_) | |_ ___| |_ __
/ _ \| '_| ' \/ _ \ \ \/\/ /| | | ' \/ -_) | ' \
/_/ \_\_| |_||_\___/ \_/\_/ |_|_|_||_\___|_|_|_|_|
tel://+43/512/394545/72
fax://+43/512/394545/20
mail:[EMAIL PROTECTED]
http://www.phion.com
Towitoko:
Reader = 0
-> pcsc_init(reader):
READER: Towitoko Chipdrive Micro 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] [ 0x2C 0xE8 0xE0 0x86 0x00 0x01 0x02 0x03 0xB7 0xC3 0x6E 0x04 0x90 0x00 ]
OK
-> pcsc_create_dir_crycs() returned 0x0:
[CMD] [ 0x84 0xE0 0x01 0x00 0x10 0x10 0x00 0x38 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0x42 0x0D 0x43 0x03 ]
[RSP] [ 0x67 0x00 ]
Error: pcsc_create_dir_crycs() no checksum to read !
pc/sc error: Unknown internal error.
0x67 0x00: Incorrect Length