我正在尝试在 localMachine Root 中添加证书。下面是我尝试过的代码,但这不允许我添加到本地机器中,而要添加它说访问被拒绝。如何允许在本地机器内安装?
X509Certificate2 cert = new X509Certificate2(@"D:\MyCertificate.pfx", "Temp@1234",
X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet);
// save certificate and private key
X509Store storeMy = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
storeMy.Open(OpenFlags.ReadWrite);
storeMy.Add(cert);