MSDN Library Home

X509V3Certificate Class

Represents a certificate that contains X.509 v3 extensions.
Overview
Members
Syntax

Class System.Net.Security.X509V3Certificate

The X509V3Certificate class is derived from the X509Certificate class and adds support for X.509 v3 extensions. These extensions provide additional information about the certificate, such as the certificate's subject alternative name, key usage, and certificate policies. This class is primarily used when working with certificates that adhere to the X.509 v3 standard.

Inheritance Hierarchy


object
  System.Security.Cryptography.AsymmetricAlgorithm
    System.Security.Cryptography.X509Certificates.X509Certificate2
      System.Security.Cryptography.X509Certificates.X509Certificate2Impl (abstract)
        System.Net.Security.X509V3Certificate
            

Remarks

X.509 v3 certificates are widely used for secure communication and authentication. The extensions defined in the v3 standard allow for greater flexibility and expressiveness compared to earlier versions. For example, the Subject Alternative Name (SAN) extension is crucial for identifying multiple host names or IP addresses within a single certificate, which is common in modern web server configurations.

When you retrieve a certificate from a store or from a remote server, it might be represented as an X509Certificate2 object. If this certificate contains v3 extensions, you can cast it to an X509V3Certificate to access these specific extension properties.

Requirements

Assembly Supported in
System.Net.dll .NET Framework 2.0, .NET Framework 3.0, .NET Framework 3.5, .NET Framework 4.0, .NET Framework 4.5, .NET Framework 4.6, .NET Framework 4.7, .NET Framework 4.8

Version Information

Initial 2.0

Members

The following table lists the members of the X509V3Certificate class.

Constructors

Properties

Methods

Syntax

This section shows the basic syntax for the X509V3Certificate class. For more detailed examples and usage, refer to the Members section.

Visual Basic


Public Class X509V3Certificate
    Inherits X509Certificate2
    ' Constructors
    Public Sub New(handle As IntPtr)
    Public Sub New(rawData() As Byte)

    ' Properties
    Public Overrides ReadOnly Property Extensions As X509ExtensionCollection
    Public Overrides ReadOnly Property IssuerName As X500DistinguishedName
    Public Overrides ReadOnly Property SubjectName As X500DistinguishedName
    Public Overrides ReadOnly Property Thumbprint As String

    ' Methods
    Public Overrides Function GetName As String
    Public Overrides Function GetName(onlyShowCompanyName As Boolean) As String
End Class
                

C#


[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public class X509V3Certificate : X509Certificate2
{
    // Constructors
    public X509V3Certificate(IntPtr handle);
    public X509V3Certificate(byte[] rawData);

    // Properties
    public override X509ExtensionCollection Extensions { get; }
    public override X500DistinguishedName IssuerName { get; }
    public override X500DistinguishedName SubjectName { get; }
    public override string Thumbprint { get; }

    // Methods
    public override string GetName();
    public override string GetName(bool onlyShowCompanyName);
}
                

C++


public ref class X509V3Certificate : public X509Certificate2
{
public:
    // Constructors
    X509V3Certificate(System::IntPtr handle);
    X509V3Certificate(cli::array<System::Byte> ^ rawData);

    // Properties
    virtual property System::Security::Cryptography::X509Certificates::X509ExtensionCollection^ Extensions
    {
        System::Security::Cryptography::X509Certificates::X509ExtensionCollection^ get() override;
    }

    virtual property System::Security::Cryptography::X500DistinguishedName^ IssuerName
    {
        System::Security::Cryptography::X500DistinguishedName^ get() override;
    }

    virtual property System::Security::Cryptography::X500DistinguishedName^ SubjectName
    {
        System::Security::Cryptography::X500DistinguishedName^ get() override;
    }

    virtual property System::String^ Thumbprint
    {
        System::String^ get() override;
    }

    // Methods
    virtual System::String^ GetName() override;
    virtual System::String^ GetName(bool onlyShowCompanyName) override;
};