[Pcsclite-muscle] Know the interface connection type with a card

Antoine FERRON aferron at cardhoc.com
Fri Aug 12 05:43:09 PDT 2022


Awesome, thanks!
I didn’t think about this. And I know this command that I use for NFC tags applications. I can confirm that nearly all contactless readers are supporting this command, so this should be a quite reliable method.

So far, I notice that some contactless readers are identified with “CL”, but it was not all the time, probably half of the readers are doing this. I tried this method, as you suggest, but I let this down, because only some readers do that. But I will combine this with the UID reading, that should provide a decent manner to infer if the card is access through the contactless interface or not.

FYI, other paths I tried without any success.  One was to read the T=15 flag from pyScard connection.getProtocol(), but it never provides this value, especially in Windows, where the Scard interface only lists T0 and T1. The other was trying to see if the ATR (ATS image) was short enough to be computed from ATS, hence being a contactless connection. But no clear limit was found for this criterion to provide any useful info.

To Sylvain Feret who also proposed the same idea,
> I haven't taken the time to figure out which of 14443-3 or -4, or maybe the WinSCard interface is handling this command.
> I would like to read about results obtained under linux/MacOS.
This command is intercepted by the reader, and not actually transmitted to the tag/chip/card. This command is a query for the reader. So this is not part of any ISO7816/14443 standards. But rather a PCSC industry defacto standard. But in case the reader doesn't support it (if contact for ex), the command is sent/forwarded to the card.
The compatibility in Linux and Mac should be good enough, as this is an APDU message and the reader will potentially handle it. I can't see any issue for this global behaviour would be different relative to the OS.

My first practical tests, I found out that some T=0 cards in contact readers are receiving this command forwarded by the reader (as the reader doesn't handle this command). And this command stalls the card, it breaks the card connection and I need to reconnect to the card in order to continue sending any new command. Pretty annoying.

AF


From: Marc Jacquinot <marc at cardwerk.com> 
Sent: 11 August 2022 17:50
To: Antoine FERRON <aferron at cardhoc.com>
Cc: pcsclite-muscle at lists.infradead.org
Subject: Re: [Pcsclite-muscle] Know the interface connection type with a card

Hi Antoine,
most PCSC compatible readers allow UID access via FFCA0000 command APDU. If you are getting an ATR and UID, you know that you are dealing with a contactless card interface. Depending on the card reader manufacturer, the reader name may also reflect the interface (CL, cl, contactless ...). However, that's not standardized.
Regards,
Marc

On Thu, Aug 11, 2022 at 10:31 AM Antoine FERRON <mailto:aferron at cardhoc.com> wrote:
Dear smartcard friends,

I'm writing here since the PyScard developer recommended to do so to get a broader audience for my question. It is not strictly about the pcsc-lite system, but more about PyScard.

Using pyscard, I recently spent some time trying to build a detection method in smartcards handling library to know whether the card connection is through contactless or with contacts. And so far, I didn't find any reliable method to get this information. This is needed as some cards behave differently depending of the access interface, mostly because internally the applet knows which interface is currently used, and can act accordingly. Also, some standards like EMV instruct to behave differently depending of the access interface. All that makes the need for knowing the access interface when talking to a smartcard.
My idea is to have in the Python card object a is_contactless attribute which is true when the connection is done through the wireless interface. How can it be done ? On Windows ? On Mac ? On Linux? Our main and first target is Windows, and I feel this is an actual issue in Windows. As the Win Scard interface doesn't seem to offer any way to read this. Hence my question, I maybe missed one thing to get this info.
I have to say the method should not rely on a specific applet, but should be universal to provide the type of access connection in use to talk with the card (RF contactless or wires contact).

Thanks,
AF

_______________________________________________
pcsclite-muscle mailing list
mailto:pcsclite-muscle at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/pcsclite-muscle



-- 
---------------------------------------------------------------
Marc Jacquinot - Smart Card Expert
<http://www.cardwerk.com/>
< Smart consulting - development - customization >
----------------------------------------------------------------
CardWerk Technologies
2615 George Busbee Pkwy
Suite 11-312
Kennesaw, GA 30144 - USA 
Office: tel:770-514-8039 
 Please consider the environment before printing this e-mail.


More information about the pcsclite-muscle mailing list