Tuesday, April 22, 2014

List locally installed digital certificates with C#

X509Store store = new X509Store(StoreName.Root,StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);
Console.WriteLine("Friendly Name\t\t\t\t\t Expiration date");
foreach (X509Certificate2 certificate in store.Certificates)
{
   Console.WriteLine("{0}\t{1}", certificate.FriendlyName,certificate.NotAfter);
}
store.Close();
 
Note: You should import this namespace (System.Security.Cryptography.X509Certificates) 

No comments:

Post a Comment

TinyMCE Insert/Edit link not editable

 To fix this add  e.stopImmediatePropagation()  as below. $(document).on('focusin', function (e) {             if ($(e.target).close...