views:

146

answers:

1

Is it possible to query certificate store on windows server 2008 using .net platform? I would like to get information about certificates that were issued by this system.

tnx grega g

A: 

With "issued certificates", do you mean certs that have been issued by this box, or to this box?

Anyway, something like this should get you started playing around with certificate stores:

using System;
using System.Security.Cryptography.X509Certificates;

class CertificateStoreSample
{
    static void Main(string[] args)
    {
        X509Store store = new X509Store(StoreName.Root);

        store.Open(OpenFlags.ReadOnly);

        foreach (X509Certificate certificate in store.Certificates)
        {
            Console.WriteLine(certificate.Subject);
        }

        store.Close();
    }
}
Arnout