I have an x509 in my local computer store. How do I read in C# ? I need to use get the private key this way
RSACryptoServiceProvider rsa = (RSACryptoServiceProvider).cert.PrivateKey()
This will get you the certificates from the "My" (personal) store.
var store = new X509Store(StoreName.My);
store.Open(OpenFlags.ReadOnly);
var certificate = store.Certificates.Single(c => c.Thumbprint == "Whatever-Your-Thumbprint-Is");
store.Close();
At that point you will have an X509Certificate2 and you can access the PrivateKey property from it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With