Hello,

I tried to use SIM explorer 
(http://ludovic.rousseau.free.fr/softwares/SIM-3.0.tar.gz)
to dump the addressbook of a brand new German T-Mobile SIM card.
I have a working setup of OpenCT/pcscd/OpenSC and even OCF bridge.

It looks like pcsc-perl 1.4.12 has some trouble getting response to this 
command:

(from SIM.pl -D output)
=> A0 C0 00 00 0F
<= 00 00 1A F4 6F 3A 04 00 11 00 22 01
SW: 22 01 (Error not defined by ISO 7816)
Get Response: ERROR: expected 90 00 and got 22 01

pcscd -adf log says:

00000014 winscard_svc.c:604:ContextThread() TRANSMIT rv=0x0 for client 6
00000206 winscard_svc.c:315:ContextThread() Received command: TRANSMIT from 
client 6
00000018 winscard.c:1539:SCardTransmit() Send Protocol: T=0
00000006 APDU: A0 C0 00 00 0F 
00099850 SW: 00 00 1A F4 6F 3A 04 00 11 00 22 01 

There is no 90 00 at the end.

However, when issuing series of ATR by hand
using opensc-explorer I end up with a proper response:

$ /usr/local/bin/opensc-explorer -m ''
OpenSC Explorer version 0.12.2
Using reader with a card: OpenCT Reader 1 00 00
OpenSC []> apdu A0 A4 00 00 02 3F 00
Sending: A0 A4 00 00 02 3F 00
Received (SW1=0x9F, SW2=0x1A)
OpenSC []> apdu A0 A4 00 00 02 7F 10
Sending: A0 A4 00 00 02 7F 10
Received (SW1=0x9F, SW2=0x1A)
OpenSC []> apdu A0 A4 00 00 02 6F 3A
Sending: A0 A4 00 00 02 6F 3A
Received (SW1=0x9F, SW2=0x0F)
OpenSC []> apdu A0 C0 00 00 0F
Sending: A0 C0 00 00 0F
Received (SW1=0x90, SW2=0x00):
00 00 1A F4 6F 3A 04 00 11 00 22 01 02 01 1E ....o:...."....

and for the last one the pcscd log says:

00000014 winscard_svc.c:604:ContextThread() TRANSMIT rv=0x0 for client 6
06125938 winscard_svc.c:315:ContextThread() Received command: TRANSMIT from 
client 6
00000025 winscard.c:1539:SCardTransmit() Send Protocol: T=0
00000007 APDU: A0 C0 00 00 0F 
00201138 SW: 00 00 1A F4 6F 3A 04 00 11 00 22 01 02 01 1E 90 00
                                                         ^^^^^^

Obviously, if not enough bytes are received from TRANSMIT
the following line from Chipcard/PCSC/Card.pm 
has no chance to properly extract SW1/SW2:

        $sw = substr $data, length ($data) -5, 5, "";

What's wrong?

//Marcin

Details on the software:

pcsc-lite 1.8.3
pcsc-perl 1.4.12
openct 0.6.12
opensc 0.12.2

on FreeBSD 9.x/amd64, using OmniKey 4040 PCMCIA card reader

_______________________________________________
Muscle mailing list
[email protected]
http://lists.drizzle.com/mailman/listinfo/muscle

Reply via email to