首页 > 编程语言 >C#.NET ASP.NET IIS 加载.pfx私钥证书时报错“出现了内部错误。”

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

时间:2022-11-25 17:00:16浏览次数:56  
标签:X509KeyStorageFlags ASP 私钥 IIS X509Certificate2 NET

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

标签:X509KeyStorageFlags,ASP,私钥,IIS,X509Certificate2,NET
From: https://www.cnblogs.com/runliuv/p/16925693.html

相关文章