[Pcsclite-muscle] Different behaviour with Select MF on Omnikey 5427 and 5022

Sebastien Lorquet sebastien at lorquet.fr
Wed Nov 4 08:40:22 EST 2020


Hello,

According to the result from the ATR parser, you are trying to use a 
Mifare 1K card. These cards do not comply with ISO/IEC 14443-A part 4 
and are not able to exchange APDUS as pcsclite does. These cards have no 
ATR but readers usually return a pseudo-ATR based on info in PC/SC 2 
part 10.

So the reader that works might be emulating commands to allow you access 
to the card. Because a mifare classic 1K card does not have a MF at all.

And the other reader does not, or does not have the same commands.

So you should look at the low level / developer documentation of your 
readers and determine which access commands must be used, because at 
this point your are in the domain of proprietary reader specific 
commands. Usually, this involves specific pseudo-APDUs where CLA=FFh, 
which directs the command to the reader. Any other CLA is not really 
specification compliant here. This is documented in PC/SC 2 part 10.

Moreover a mifare classic card requires authentication to read anything 
but sector 0. A proxmark reader can be useful to debug these cards.


If the ATR parser is wrong, and your card complies with ISO/IEC 14443 
part 4 either A or B (which is usually incorrectly called T=CL) - could 
be the case with a DesFire card, then the problems are elsewhere:

Either the reader has a polling problem (it is very complex to correctly 
emulate the insertion/power status of a contact card with contactless 
cards), or the reader does not wait the card long enough, or something else.

The first step would be to test yet another reader, and to spy the 
contactless protocol with an analysis tool to determine if the 
contactless dialog between the card and the reader is compliant.


Sebastien

Le 04/11/2020 à 11:54, Stephan Guilloux a écrit :
> Hmmmm...
> If it was the case, it should not be possible to access the card at all, right ?
> But ... I'm able to read the UID, with both readers and both return the same...
>
>
> Stéphan GUILLOUX
> Ingénieur Développement Sr
>
> 40 avenue de la libération 57160 Châtel St-Germain
> Tél. 03 87 65 98 80 / poste 221
> stephan.guilloux at crisalid.com
>
> LES LOGICIELS QUI VOUS DONNENT DES AILES ! - www.crisalid.com
>
>
>
>
> Le mer. 4 nov. 2020 à 11:36, Ludovic Rousseau
> <ludovic.rousseau at gmail.com> a écrit :
>> Le mer. 4 nov. 2020 à 11:15, Stephan Guilloux
>> <stephan.guilloux at crisalid.com> a écrit :
>>> Here you are.
>>>
>>> I took the opportunity to update PCSC and CCID to the latest versions
>>> available (1.9.0 and 1.4.33).
>>> Results are the same.
>>>
>>> To reproduce, I ran the last official scard_example.go and rebuilt it
>>> with the libs above.
>>> scard_example output is inserted in each PCSC log file.
>>>
>>> For comparison, the same process is used with a 5427 and a 5022.
>>> 5427 logs are attached in this mail.
>>> 5022 will be sent in a second mail.
>>  From log-hid-5427-card1-ko.txt
>>
>> 00000037 [1963975616] ifdhandler.c:1868:IFDHICCPresence()
>> usb:076b/5427:libhal:/org/freedesktop/Hal/devices/usb_device_076b_5427_serialnotneeded_if0
>> (lun: 0)
>> 00000039 [1963975616] -> 000000 65 00 00 00 00 00 04 00 00 00
>> 00001820 [1963975616] <- 000000 81 00 00 00 00 00 04 01 00 01
>> 00000037 [1963975616] ifdhandler.c:1989:IFDHICCPresence() Card present
>> 00000040 [1963975616] ifdhandler.c:1167:IFDHPowerICC() action:
>> PowerUp, usb:076b/5427:libhal:/org/freedesktop/Hal/devices/usb_device_076b_5427_serialnotneeded_if0
>> (lun: 0)
>> 00000965 [1963975616] -> 000000 62 00 00 00 00 00 05 00 00 00
>> 00217134 [1963975616] <- 000000 80 00 00 00 00 00 05 42 FE 00
>> 00000052 [1963975616] commands.c:243:CmdPowerOn Card absent or mute
>> 00000031 [1963975616] ifdhandler.c:1234:IFDHPowerICC() PowerUp failed
>>
>> The reader reports a card present but can't power on the card.
>>
>> Later in the log:
>> 00000034 [1953493952] APDU: 00 A4 00 0C 02 3F 00
>> 00000028 [1953493952] ifdhandler.c:1316:IFDHTransmitToICC()
>> usb:076b/5427:libhal:/org/freedesktop/Hal/devices/usb_device_076b_5427_serialnotneeded_if0
>> (lun: 0)
>> 00000046 [1953493952] commands.c:1634:CmdXfrBlockAPDU_extended() T=0
>> (extended): 7 bytes
>> 00000053 [1953493952] -> 000000 6F 07 00 00 00 00 0C 00 00 00 00 A4 00
>> 0C 02 3F 00
>> 00039734 [1953493952] <- 000000 80 00 00 00 00 00 0C 40 FE 00
>> 00000069 [1953493952] commands.c:1534:CCID_Receive Card absent or mute
>> 00000024 [1953493952] SW:
>> 00000024 [1953493952] ifdwrapper.c:543:IFDTransmit() Card not transacted: 612
>> 00000024 [1953493952] winscard.c:1620:SCardTransmit() Card not
>> transacted: 0x80100016
>>
>> The reader reports that the card is no more present.
>>
>> I suspect a communication problem between the card and the reader.
>> Contactless communication is not easy.
>>
>> Both cards are Mifare cards
>> https://smartcard-atr.apdu.fr/parse?ATR=3B8F8001804F0CA000000306030001000000006A
>> Maybe they are not exactly the same model.
>>
>> Maybe someone here has an explanation.
>>
>> Bye
>>
>> --
>>   Dr. Ludovic Rousseau
>>
>> _______________________________________________
>> pcsclite-muscle mailing list
>> pcsclite-muscle at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/pcsclite-muscle
> _______________________________________________
> pcsclite-muscle mailing list
> pcsclite-muscle at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/pcsclite-muscle



More information about the pcsclite-muscle mailing list