SslStreamCertificateContext.Create Method

Definition

Overloads

Create(X509Certificate2, X509Certificate2Collection, Boolean)

Attempts to build the certificate chain from the provided certificates.

Create(X509Certificate2, X509Certificate2Collection, Boolean, SslCertificateTrust)

Attempts to build the certificate chain from the provided certificates.

Create(X509Certificate2, X509Certificate2Collection, Boolean)

Source:
SslStreamCertificateContext.cs
Source:
SslStreamCertificateContext.cs
Source:
SslStreamCertificateContext.cs

Attempts to build the certificate chain from the provided certificates.

C#
public static System.Net.Security.SslStreamCertificateContext Create(System.Security.Cryptography.X509Certificates.X509Certificate2 target, System.Security.Cryptography.X509Certificates.X509Certificate2Collection? additionalCertificates, bool offline);
C#
public static System.Net.Security.SslStreamCertificateContext Create(System.Security.Cryptography.X509Certificates.X509Certificate2 target, System.Security.Cryptography.X509Certificates.X509Certificate2Collection? additionalCertificates, bool offline = false);

Parameters

target
X509Certificate2

The server certificate.

additionalCertificates
X509Certificate2Collection

Supplementary certificates used to build the certificate chain.

offline
Boolean

false to indicate that the missing certificates can be downloaded from the network; true to indicate that only available X509Certificate stores should be searched for missing certificates.

Returns

The certificate context with the newly created certificate chain.

Exceptions

target doesn't have an associated private key.

Remarks

The provided certificates should not be disposed during the lifetime of the SslStreamCertificateContext.

Important

The target certificate must include a private key.

Applies to

.NET 10 and other versions
Product Versions
.NET 5, 6, 7, 8, 9, 10

Create(X509Certificate2, X509Certificate2Collection, Boolean, SslCertificateTrust)

Source:
SslStreamCertificateContext.cs
Source:
SslStreamCertificateContext.cs
Source:
SslStreamCertificateContext.cs

Attempts to build the certificate chain from the provided certificates.

C#
public static System.Net.Security.SslStreamCertificateContext Create(System.Security.Cryptography.X509Certificates.X509Certificate2 target, System.Security.Cryptography.X509Certificates.X509Certificate2Collection? additionalCertificates, bool offline = false, System.Net.Security.SslCertificateTrust? trust = default);

Parameters

target
X509Certificate2

The server certificate.

additionalCertificates
X509Certificate2Collection

Supplementary certificates used to build the certificate chain.

offline
Boolean

false to indicate that the missing certificates can be downloaded from the network; true to indicate that only available X509Certificate stores should be searched for missing certificates.

trust
SslCertificateTrust

An optional trust policy, to replace the default system trust.

Returns

The certificate context with the newly created certificate chain.

Exceptions

target doesn't have an associated private key.

Remarks

The provided certificates should not be disposed during the lifetime of the SslStreamCertificateContext.

Important

The target certificate must include a private key.

Applies to

.NET 10 and other versions
Product Versions
.NET 6, 7, 8, 9, 10