智能卡读卡器命名

时间:2014-07-07 14:19:17

标签: c# smartcard smartcard-reader pcsc winscard

我在系统中有两个读者(HID OMNIKEY 5321)(每个读者执行不同的功能)

  • 读卡器1 - "智能卡读卡器 0 "
  • 读卡器2 - "智能卡读卡器 1 "

在我的程序中设置了

  • "智能卡读卡器 0 " - 行动1
  • "智能卡读卡器 1 " - 行动2

但有时候(没有重新启动,可能失去联系)

  • 读者1获得名称"智能卡读卡器 1 "
  • 读者2获得名称"智能卡读卡器 0 "

并且该程序不能满足用户的需求。 我在WinScard.dll中使用SCardGetStatusChange(需要读者的名字)

怎么办? 有没有办法改变阅读器的名称(固件,驱动程序......)? 是否可以使用阅读器的序列号?

我也看了,但没有结果 Smartcard reader naming: when removing any reader, the name of the rest changes How are PCSC smart card reader 'friendly names' constructed?

2 个答案:

答案 0 :(得分:3)

找到了解决方案Getting PCSC reader serial number with WinSCard

序列号阅读器

...
SCardConnect(hContext, readerName, SCARD_SHARE_DIRECT, SCARD_PROTOCOL_UNDEFINED, ref hCard, ref protocol);
SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_IFD_SERIAL_NO, receiveBuffer, ref receivebufferLen);
...

答案 1 :(得分:0)

也许您应该专注于插入/连接到阅读器而不是阅读器本身的智能卡,并使用卡特定信息(即序列号或标签)来选择正确的阅读器。