gpt4 book ai didi

c# - CSP 未检测到智能卡微型驱动程序 C#

转载 作者:太空宇宙 更新时间:2023-11-03 16:21:33 25 4
gpt4 key购买 nike

我正在使用智能卡编写一个用于加密目的的小程序,但我的微型驱动程序有问题。当我启动程序时,我可以看到该卡(出现选择智能卡的弹出对话框)但由于以下原因我无法使用它:

A smart card was detected but is not the one required for the current operation. The smart card you are using may be missing required driver software or a required certificate. 

我使用的 C# 代码非常简单,如下所示:

CspParameters csp = new CspParameters(
1,
"Microsoft Base Smart Card Crypto Provider",
"my_container"
);
RSACryptoServiceProvider rsa = new RSACryptoServiceProvider(csp);

请注意,我有另一个识别此微型驱动程序的应用程序(Gemalto 微型驱动程序管理器),因此问题不存在。

提前致谢

更新

为了让 CSP 识别智能卡,您需要告诉它使用默认 key 容器。只需在创建 RSACryptoServiceProvider 之前添加下一行:

csp.Flags = CspProviderFlags.UseDefaultKeyContainer;

最佳答案

检查微型驱动程序是否同时安装在 32 位和 64 位模式下。在 64 位上,微型驱动程序及其配置(在 calais 数据库中)必须同时设置为 32 位和 64 位模式。

关于c# - CSP 未检测到智能卡微型驱动程序 C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13743314/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com