简体   繁体   中英

How To Detect Smart Card Reader Interface Characteristic

I am using winscard.dll within my Do.net smart card application. My reader, an Omnikey 5321 has both a contact and a contactless interface, which are detected as two different readers. The contactless has the letters "CL" within it's name. I have no problems manually selecting the readers and doing everything I need to with them.

Is there a reliable way however, using SCardGetAttrib or another call, to determine which of these readers supports ISO14443 - ie EMV contactless? I would ultimately like a quick "Select Contactless settings" button, which would be generic enough to work with all PC/SC readers, and therefore also allow me to disable contactless options if such an interface is not present.

No, there is no such method simply for the reason, that PCSC is older than contactless technology (ancient contactless chips were older but required special readers and drivers, so there was no overlap). Therefore only the naming convention for the reader name provides this information ina manufacturer dependent way. In practice, this does not matter. You don't label your readers, so that the user is able to select the correct one but typically simply demand, that the user plugs in/lays on the card to the reader. PCSC will then allow to detect, which reader is loaded, as long as it is only one.

You can use Advanced Query Syntax to search for devices exposing smartcard interface class and having NFC enabled.

string query = "System.Devices.InterfaceClassGuid:=\"{DEEBE6AD-9E01-47E2-A3B2-A66AA2C036C9}\"";
if (readerKind != SmartCardReaderKind.Any)
{
   query += " AND System.Devices.SmartCards.ReaderKind:=" + (int)readerKind;
}

DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(query);

where readerKind is of Windows Runtime type Windows.Devices.SmartCards.SmartCardReaderKind . Code snippet comes from official Microsoft NFC UWP example (PscsUtils.cs).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM