MSDN Library

CertificateChain Class

Declaration

public sealed class CertificateChain : System.Collections.Generic.IEnumerable<System.Security.Cryptography.X509.X509Certificate2>

Represents a certificate chain that is used in the authentication of an X.509 certificate.

Namespace: System.Net.Security

Assembly: System (in System.dll)

Syntax

The CertificateChain class is part of the System.Net.Security namespace and is available in the System.dll assembly. It implements the IEnumerable<X509Certificate2> interface.

Members

Properties

Name Description
ChainStatus Gets the status of the certificate chain.
ChainPolicyErrors Gets the policy errors of the certificate chain.
Count Gets the number of certificates in the chain.

Methods

Name Description
GetEnumerator Returns an enumerator that iterates through the certificate chain.
GetChainElement Retrieves a specific element from the certificate chain.

Fields

This class has no public fields.

Property: ChainStatus

public X509ChainStatus[] ChainStatus { get; }

Gets an array of X509ChainStatus objects that describe the status of the certificate chain.

Property: ChainPolicyErrors

public System.Security.Cryptography.X509.X509ChainPolicyError ChainPolicyErrors { get; }

Gets the policy errors associated with the certificate chain validation.

Property: Count

public int Count { get; }

Gets the number of certificates contained in the certificate chain.

Method: GetEnumerator

public System.Collections.Generic.IEnumerator<System.Security.Cryptography.X509.X509Certificate2> GetEnumerator();

Returns an enumerator that iterates through the collection of certificates in the chain.

Return Value

An IEnumerator<X509Certificate2> object.

Method: GetChainElement

public System.Security.Cryptography.X509.X509ChainElement GetChainElement(int element);

Retrieves a specific element from the certificate chain at the specified index.

Parameters

Name Type Description
element int The zero-based index of the certificate chain element to retrieve.

Return Value

An X509ChainElement object representing the certificate at the specified index.

Exceptions

Type Description
ArgumentOutOfRangeException element is less than zero or greater than or equal to Count.

Requirements

Requirement Type Details
.NET Framework Supported in: 4.8, 4.7.2, 4.7.1, 4.7, 4.6.2, 4.6.1, 4.6, 4.5.2, 4.5.1, 4.5, 4.0, 3.5, 3.0, 2.0
Client Profile: Supported
Core General: Supported in .NET Core 2.0, 2.1, 2.2, 3.0, 3.1 and .NET 5+
Windows Requires Windows 2000, Windows XP, Windows Server 2003, or later.
.NET Standard Supported in .NET Standard 2.0, 2.1