Return to Snippet

Revision: 41438
at February 18, 2011 01:23 by hairajeshk


Initial Code
private static void AccessPersonalStore() 
{ 
    // Access the personal store 
    X509Store store = new X509Store(StoreName.My); 
    // Open the store as ReadOnly 
    store.Open(OpenFlags.ReadOnly);

    if (store.Certificates.Count > 0) 
    { 
        foreach (X509Certificate2 cert in store.Certificates) 
        { 
            Console.WriteLine("Certificate algorithm: " + cert.SignatureAlgorithm.FriendlyName); 
            Console.WriteLine("Certificate issuer: " + cert.IssuerName); 
            Console.WriteLine("Certificate serial: " + cert.SerialNumber); 
            Console.WriteLine("Certificate valid after: " + cert.NotBefore.ToShortDateString()); 
            Console.WriteLine("Certificate valid until: " + cert.NotAfter.ToShortDateString()); 
            // etc... Many properties and methods are available. 
            Console.WriteLine(); 
            Console.WriteLine("----------------------"); 
            Console.WriteLine(); 
        }

        Console.ReadLine(); 
    }

}

Initial URL
http://www.codequake.com/post/2010/08/12/How-to-access-certificates-using-C.aspx

Initial Description
http://www.codequake.com/post/2010/08/12/How-to-access-certificates-using-C.aspx

Initial Title
Accessing certification using c#

Initial Tags

                                

Initial Language
C#