读卡器中的智能卡是否对应于证书,c#

发布于 2024-08-31 01:52:51 字数 76 浏览 1 评论 0原文

我已将证书从智能卡导入到我的证书存储中,

我想检查(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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海少女心 2024-09-07 01:52:51

我手边没有智能卡读卡器,但据我记得,当您尝试访问私钥时(例如,尝试签名或解密时),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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文