[Pcsclite-muscle] Which APIs are needed to read multiple smartcards in multiple readers?

Ludovic Rousseau ludovic.rousseau at gmail.com
Tue Mar 30 16:52:28 BST 2021


Le lun. 22 mars 2021 à 12:58, Graham Leggett <minfrin at sharp.fm> a
écrit :> Hi all,

Hello Graham,

Sorry for the delay. Your email was in my gmail spam folder.

> I am trying to develop an application that reads one or more smartcards, and I need to do so without the end user being asked any questions.
>
> Most specifically, if the end user plugs in two smartcard readers made by two different manufacturers, and those readers in turn contain two different smartcards made by two different manufacturers (different ATRs), I need this to Just Work(TM). Obviously drivers for both readers and smartcards need to be present, that’s a given.
>
> My understanding is that pcsclite (PC/SC) will give me an API that allows me to access all (supported) plugged in readers, and allows me to not care about the details of reader drivers. I can call APIs like SCardListReaders() and friends, and I can return the ATRs of smartcards using SCardGetStatusChange().
>
> So far so good.

Exact.
You can play with pcsc_scan and connect/disconnect your readers,
insert/remove the cards.
https://ludovicrousseau.blogspot.com/2014/03/level-1-smart-card-support-on-gnulinux.html

> Now that my code knows that multiple readers are present, and knows the ATRs of the cards, what API do I use to read the smartcards themselves? I am assuming the API is PKCS11.
>
> Most specifically, is there a library that I should be using that will use the correct PKCS11 driver corresponding to the inserted smartcard, and will handle routing the calls to the correct driver and the same smartcard?
>
> Where I am struggling is that I can find a lot of code that tries to connect to one smartcard and one smartcard only. I want to give the end user a good experience where if they plug in multiple cards  the multiple cards “just work” and nothing weird happens from the end user’s perspective.
>
> I understand that NSS is one such library that can handle multiple PKCS11 drivers at once. Is NSS what I should be using, or can this be done with PKCS11 directly?

The important question are:
- what are your smart cards?
- do you have the PKCS#11 library corresponding to your cards?

Bye

-- 
 Dr. Ludovic Rousseau



More information about the pcsclite-muscle mailing list