What is the difference between X509Certificate2 and X509Certificate in .NET?

Kyle picture Kyle · Jul 25, 2009 · Viewed 49.7k times · Source

What is the difference between the two?

Answer

p.campbell picture p.campbell · Jul 25, 2009

The x509Certificate was introduced in .NET v1.0/1.1 and was (comparatively) limited in its functionality. It can be used to get information about an existing certificate (valid dates, issuer, etc.). It had simple methods/operations (i.e. reading a cert from disk).

The x509Certificate2 is a subclass of x509Certificate with additional functionality.

  • It represents an actual X509 certificate.
  • It was new in the .NET Framework v2.0.
  • This class gives you access to all the V2 and V3 properties (authority key identifier and key usage).
  • It supports loading a certificate from a certificate store.