代码:
//添加个人证书
X509Certificate2 certificate = new X509Certificate2("C:\test.p12","证书密码");
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadWrite);
store.Remove(certificate); //可省略
store.Add(certificate);
store.Close();
store.Open(OpenFlags.ReadWrite); 这就话报错
错误提示:
System.Security.Cryptography.CryptographicException: 拒绝访问。
在 System.Security.Cryptography.X509Certificates.X509Store.Open(OpenFlags flags)
在 PcHealthDoctor.MainForm.MainForm_Load(Object sender, EventArgs e) 位置 D:\PcHealthDoctor\PcHealthDoctor\MainForm.cs:行号 208