System.Net.Security.SslAuthenticationOptions Class

Provides options for configuring SSL/TLS authentication for network connections.

On this page

Overview

The SslAuthenticationOptions class is used to specify granular control over how SSL/TLS certificates are validated and trusted when establishing secure network connections. It allows developers to customize certificate chain validation, hostname matching, and the use of specific certificate policies. This class is typically used in conjunction with classes like SslStream and HttpClientHandler to enforce custom security behaviors.

By leveraging SslAuthenticationOptions, applications can implement more robust and tailored security strategies for sensitive network communications.

Syntax


public sealed class SslAuthenticationOptions
            

Remarks

When creating an SslAuthenticationOptions object, you can configure various aspects of the SSL/TLS handshake and certificate validation process. This includes:

This class is part of the System.Net.Security namespace, providing fundamental building blocks for secure network programming in .NET.

Constructors

The SslAuthenticationOptions class has the following constructors:

SslAuthenticationOptions()

Initializes a new instance of the SslAuthenticationOptions class with default settings.


public SslAuthenticationOptions()
                

Properties

The SslAuthenticationOptions class exposes the following properties:

RemoteCertificateValidationCallback

Gets or sets a delegate that contains the callback method to validate the server's certificate.


public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; }
                

Property Value

A RemoteCertificateValidationCallback delegate that represents the callback method for validating the server's certificate. The default is null, which means that the system's default certificate validation logic is used.

ClientCertificateOptions

Gets or sets an enum that specifies whether to send the client certificate to the server.


public ClientCertificateOption ClientCertificateOptions { get; set; }
                

Property Value

A ClientCertificateOption value that indicates whether to send the client certificate to the server. The default is ClientCertificateOption.Manual.

TargetHost

Gets or sets the target host for which the certificate is intended.


public string TargetHost { get; set; }
                

Property Value

A string that represents the target host.

Methods

The SslAuthenticationOptions class does not define any public methods beyond those inherited from System.Object.

Events

The SslAuthenticationOptions class does not define any public events.

Requirements

Assembly File
System.Net.Security.dll C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.0\System.Net.Security.dll
Framework Versions Supported
.NET Core 3.1, 3.0, 2.2, 2.1, 2.0
.NET Framework 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