简体   繁体   English

如何检测智能卡读卡器接口特性

[英]How To Detect Smart Card Reader Interface Characteristic

I am using winscard.dll within my Do.net smart card application.我在我的 Do.net 智能卡应用程序中使用 winscard.dll。 My reader, an Omnikey 5321 has both a contact and a contactless interface, which are detected as two different readers.我的阅读器 Omnikey 5321 具有接触式和非接触式界面,它们被检测为两个不同的阅读器。 The contactless has the letters "CL" within it's name.非接触式设备的名称中包含字母“CL”。 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?但是,是否有一种可靠的方法,使用 SCardGetAttrib 或其他调用来确定这些阅读器中的哪些支持 ISO14443 - 即 EMV 非接触式? 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.我最终想要一个快速的“选择非接触式设置”按钮,它足够通用,可以与所有 PC/SC 阅读器一起使用,因此如果这样的界面不存在,我也可以禁用非接触式选项。

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). 不,没有这样的方法,仅仅因为PCSC比非接触式技术更古老(古老的非接触式芯片较旧但需要特殊的读卡器和驱动器,所以没有重叠)。 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. 然后,PCSC将允许检测哪个读取器被加载,只要它只有一个。

You can use Advanced Query Syntax to search for devices exposing smartcard interface class and having NFC enabled.您可以使用高级查询语法来搜索公开智能卡接口 class 并启用 NFC 的设备。

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 .其中 readerKind 是 Windows 运行时类型Windows.Devices.SmartCards.SmartCardReaderKind Code snippet comes from official Microsoft NFC UWP example (PscsUtils.cs).代码片段来自官方 Microsoft NFC UWP 示例 (PscsUtils.cs)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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