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

How to Create Events Using Microsoft Graph API with Delegated Permissions and MSAL.js

Microsoft Graph API provides powerful capabilities to interact with Microsoft 365 services. In this guide, we’ll explore how to create calen...