繁体   English   中英

certMgr.exe未在个人本地计算机存储中加载证书的私钥(Windows 10)

[英]certMgr.exe not loading the private key of certificate in personal local machine store(Windows 10)

我有一个运行certmgr.exe的应用程序在root和personal文件夹中的localMachine上安装证书。 以下是我正在使用的命令

CertMgr.exe -add -all "secure\certs\cacert.crt" -s -r localMachine root
CertMgr.exe -add -all "secure\certs\server.p12" -s -r localMachine my

当我通过命令提示符运行这些命令分别在windows7 / 8平台上安装这些证书时,证书会安装并且它们可以工作

但是当我在Windows 10平台上运行相同的命令时,证书会在商店中安装,但它们不起作用。 出现以下错误:

错误:-2506:加载设备私钥'CN = ABB认证服务器,OU = CSA,O = ABB'从Windows商店'MY'失败ERROR:-2506:无法从Windows商店加载私钥/证书对

证书是正确的,我通过手动导入mmc中的证书来验证这一点。 当我手动导入时,它们开始工作。 显然,我发现certmgr.exe或Windows 10平台中的访问权限存在问题。 我试过不同的“certmgr.exe”,但无法解决问题。

好,

以下代码在.Net中为我工作:

Dim store As New System.Security.Cryptography.X509Certificates.X509Store(X509Certificates.StoreName.Root, X509Certificates.StoreLocation.LocalMachine)
store.Open(X509Certificates.OpenFlags.ReadWrite)
Dim cert As New System.Security.Cryptography.X509Certificates.X509Certificate2("c:\cert.pfx", "password")
store.Add(cert)
store.Close()

尝试通过右键单击cmd app从system32文件夹中的“以管理员身份运行”选项从cmd运行CertMgr.exe。

暂无
暂无

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

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