读卡器中的智能卡是否对应于证书,c#
我已将证书从智能卡导入到我的证书存储中,
我想检查(c# 代码)证书是否处于活动状态,即读卡器中的智能卡是否对应于我的证书
I have certificate imported from smart card into my certificate store
I would like to check (c# code) whether certificate is active i.e. does the smart card in the reader corresponds to my certificate
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我手边没有智能卡读卡器,但据我记得,当您尝试访问私钥时(例如,尝试签名或解密时),CSP 的 UI 会弹出,要求您插入正确的卡和/或提供 PIN 码。如果您使用不同的卡(这样证书/私钥将不匹配),那么操作将失败(我的猜测是会抛出 CryptographicException )。我还没有听说过查询智能卡的通用方法(当然这并不意味着没有)。
I don't have smart card reader at hand but from what I remember when you try to access private key (eg. when trying to sign or decrypt) UI from CSP will pop up asking that you insert correct card and/or provide pin number. If you use different card (so that certificate/private key won't match) then the operation will fail (my guess is that CryptographicException will be thrown). I haven't heard of generic way to query smart cards (which of course doesn't mean there isn't any).