Different Ways To Get Hold On Certificates – Net FX 1.1, 2.0

Net FX 1.1:

First, one need to export certificate to file (no private keys exported), from


// TODO: Replace with a valid path to your certificate
string certPath = @"C:\WSClientCert.cer"

// create an X509Certificate object from the information
// in the certificate export file and add it to the


Net FX 2.0:

2.0 has new classes to get hold on cert directly from cert store, from http://msdn.microsoft.com/msdnmag/issues/07/03/netsecurity/default.aspx 


static X509Certificate2 FindCertificate(
StoreLocation location, StoreName name,
X509FindType findType, string findValue)
     X509Store store = new X509Store(name, location);
          // create and open store for read-only access
          // search store
          X509Certificate2Collection col = store.Certificates.Find(findType, findValue,true);

          // return first certificate found
          return col[0];
     // always close the store
     finally { store.Close(); }


Comments (1)
  1. alik levin's says:

    Windows Authentication Identity Flow Through Physical Tiers Identity Flow Through Physical Tiers – Impersonation

Comments are closed.

Skip to main content