Get list of certificates from the certificate store in C#
For a secure application I need to select a certificate in a dialog. How can I access certificate store or a part of it (e.g. storeLocation="Local Machine" and storeName="My" ) using C# and get a collection of all certificates from there? Thanks in advance for your help. acejologz X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadOnly); foreach (X509Certificate2 certificate in store.Certificates){ //TODO's } Try this: //using System.Security.Cryptography.X509Certificates; public static X509Certificate2 selectCert(StoreName store, StoreLocation