I want to install a certificate on a machine if it doesn't have it installed already. I tried checking if the store contains the certificate but somehow my store is always empty. I checked "Intermediate Certification Authorities" folder and found 18 certificates there. So why does this code write 0?
X509Store store = new X509Store(StoreName.CertificateAuthority, StoreLocation.LocalMachine);
Console.WriteLine(store.Certificates.Count);
I also tried StoreLocation.CurrentUser. What am I doing wrong?
You have to call store.Open(OpenFlags.ReadWrite);
before you can access the certificates.
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