On Monday, May 6, 2002, at 09:43  am, Arno Wilhelm wrote:

> Hello,
>
>
> it worked at least !!

Good news :).

> 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

What you actually sent is an case-4 APDU stating that you expect 256 
bytes back (Le=0x00). The driver "corrected" the Le when it received the 
SW from the card (61 03), which is good.

> It seems that the towitoko driver works at the TPDU level and ignores 
> the Le field at the end. So this did not matter ?!

As Carlos pointed out in an earlier reply, this behaviour can be 
modified at compilation time.

> � 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:

No, the behaviour of the driver is not based on the value of the status 
word but on the structure of the command that was sent. See the 
explanation below.

> -> 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?

Here, you send CLA,INS,P1,P2,Lc,Data and no Le (TxLength in your call 
must be set to this). This is a case 3 command as you did not supply Le. 
This is why the driver does not send the Get Response (it returned 61 0C 
as if it was a standard SW).

>
> 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?

No, you sent a proper case 3 APDU, but not a proper case 4 APDU :). It 
is therefore normal that it works!

> > 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.

If most drivers work like Carlos' by default, you should treat a case 4 
APDU as a case 3 and send the Get response at the application level.

Anybody willing to share their ideas on this?

Cheers,
JLuc.



***************************************************************
Unix Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/
To unsubscribe send an email to [EMAIL PROTECTED] with
unsubscribe sclinux
***************************************************************

Reply via email to