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

Michael StJohns mstjohns at comcast.net
Mon Aug 15 14:11:35 PDT 2022

On 8/11/2022 10:31 AM, Antoine FERRON 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
> pcsclite-muscle at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/pcsclite-muscle

SCardGetAttrib with SCARD_ATTR_CURRENT_PROTOCOL_TYPE should get you what 
you want...


More information about the pcsclite-muscle mailing list