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

I Built a New Kind of Number Puzzle Game (And You Can Play It Free)

 For a long time, I wanted to play a mobile puzzle game that felt genuinely strategic—something that required real brainpower, skipped the a...