runliuv

runliuv@cnblogs

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

C#.NET ASP.NET IIS 加载.pfx私钥证书时报错“出现了内部错误。”

 

原始代码报错:

X509Certificate2 x509cer = new X509Certificate2(rawData, m.cert_pwd);

 

解决方法,加上enum:

X509Certificate2 x509cer = new X509Certificate2(rawData, m.cert_pwd,
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.Exportable);

 

X509Certificate2

posted on 2022-11-25 16:54  runliuv  阅读(152)  评论(0编辑  收藏  举报