In Win Server 2008, I can execute the code below, and when I try to export a certificate through the MMC GUI, I have no way to export the private key. However, if I use the GUI to import the certificate, I can also export the private key. What am I missing in my code?
string certfile = @"mycert.p12"; SecureString secString = new SecureString(); foreach (char c in "password") { secString.AppendChar(c); } X509Certificate2 cert = new X509Certificate2(certfile, secString, X509KeyStorageFlags.Exportable); var store = new X509Store(StoreName.My , StoreLocation.CurrentUser); store.Add(cert);
Snowy source share