Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

What is the difference between the two?

like image 244
Kyle Avatar asked Jul 25 '09 17:07

Kyle


People also ask

What is X509Certificate2 C#?

X509Certificate2(String, String, X509KeyStorageFlags) Initializes a new instance of the X509Certificate2 class using a certificate file name, a password used to access the certificate, and a key storage flag. X509Certificate2(String, SecureString, X509KeyStorageFlags)

What is X509Chain?

The X509Chain object has a global error status called ChainStatus that should be used for certificate validation. The rules governing certificate validation are complex, and it is easy to oversimplify the validation logic by ignoring the error status of one or more of the elements involved.


1 Answers

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.
like image 75
p.campbell Avatar answered Oct 12 '22 17:10

p.campbell