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

Graham Leggett minfrin at sharp.fm
Mon Mar 22 11:57:25 GMT 2021


Hi all,

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.

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?

Regards,
Graham
—




More information about the pcsclite-muscle mailing list