Language

SslStreamCertificateContext.Create Method

Definition

Overloads

Name Description
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
Source:
SslStreamCertificateContext.cs
Source:
SslStreamCertificateContext.cs

Attempts to build the certificate chain from the provided certificates.

public:
 static System::Net::Security::SslStreamCertificateContext ^ Create(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ target, System::Security::Cryptography::X509Certificates::X509Certificate2Collection ^ additionalCertificates, bool offline);
public static System.Net.Security.SslStreamCertificateContext Create(System.Security.Cryptography.X509Certificates.X509Certificate2 target, System.Security.Cryptography.X509Certificates.X509Certificate2Collection? additionalCertificates, bool offline);
public static System.Net.Security.SslStreamCertificateContext Create(System.Security.Cryptography.X509Certificates.X509Certificate2 target, System.Security.Cryptography.X509Certificates.X509Certificate2Collection? additionalCertificates, bool offline = false);
static member Create : System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.X509Certificates.X509Certificate2Collection * bool -> System.Net.Security.SslStreamCertificateContext
Public Shared Function Create (target As X509Certificate2, additionalCertificates As X509Certificate2Collection, offline As Boolean) As SslStreamCertificateContext
Public Shared Function Create (target As X509Certificate2, additionalCertificates As X509Certificate2Collection, Optional offline As Boolean = false) As SslStreamCertificateContext

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

Create(X509Certificate2, X509Certificate2Collection, Boolean, SslCertificateTrust)

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

Attempts to build the certificate chain from the provided certificates.

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);
static member Create : System.Security.Cryptography.X509Certificates.X509Certificate2 * System.Security.Cryptography.X509Certificates.X509Certificate2Collection * bool * System.Net.Security.SslCertificateTrust -> System.Net.Security.SslStreamCertificateContext
Public Shared Function Create (target As X509Certificate2, additionalCertificates As X509Certificate2Collection, Optional offline As Boolean = false, Optional trust As SslCertificateTrust = Nothing) As SslStreamCertificateContext

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. A custom certificate chain policy on the authentication options takes precedence for remote certificate validation.

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.

If CertificateChainPolicy or CertificateChainPolicy isn't null, the specified chain policy supersedes the trust argument for remote certificate validation. The TrustMode and CustomTrustStore properties determine trust instead. The server still sends the trust list during the TLS handshake if the trust policy is configured to do so.

Important

The target certificate must include a private key.

Applies to