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

Antoine FERRON aferron at cardhoc.com
Tue Aug 16 03:52:00 PDT 2022


> SCardGetAttrib with SCARD_ATTR_CURRENT_PROTOCOL_TYPE should get you 
> what you want...
> Forgot to mention that T=CL is probably encoded as T=15

Well, I tried similar things, and this provides always 1, 2 or 3 (T0, T1, T0/T1), at least on Windows. It never provides 8 nor 15 value. Maybe in Linux ?
For now, I'm using pyscard connection.getProtocol(), and this is the same? This reads SCARD_ATTR_CURRENT_PROTOCOL_TYPE ? You think SCARD_ATTR_CURRENT_PROTOCOL_TYPE will provide a different value from connection.getProtocol() ? That will provide 8 or 15 on Windows? To me, the Winscard interface never tells you about contactless protocol used.


-----Original Message-----
From: pcsclite-muscle <pcsclite-muscle-bounces at lists.infradead.org> On Behalf Of Michael StJohns
Sent: 16 August 2022 04:02
To: pcsclite-muscle at lists.infradead.org
Subject: Re: [Pcsclite-muscle] Know the interface connection type with a card

On 8/15/2022 5:11 PM, Michael StJohns wrote:
> 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...
>
> Mike
>
>
Sorry - forgot to mention that T=CL is probably encoded as T=15

Mike



_______________________________________________
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