我正在使用此代码从 PFX 文件导入证书:
string certPath = @"C:\a\something.eu.pfx";
string certPass = "password";
// Create a collection object and populate it using the PFX file
X509Certificate2 certifikat = new X509Certificate2();
certifikat.Import(certPath, certPass, X509KeyStorageFlags.PersistKeySet);
X509Store store = new X509Store();
store.Open(OpenFlags.MaxAllowed);
store.Add(certifikat);
store.Close();
它执行无误,但证书没有出现在“虚拟主机”商店中。我如何将其导入该商店?
最佳答案
使用 X509Store
构造函数,您可以指定要打开的商店。您需要本地计算机的“Web 托管”存储(内部名称:“WebHosting”),因此构造类如下:
var store = new X509Store("WebHosting", StoreLocation.LocalMachine);
关于c# - PFX 文件导入到 C# 中的 Webhosting 存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41139543/