SSLProtocol Enum
Namespace: System.Net.Security
Assembly: System (in System.dll)
Specifies the protocols that are used by the SslStream class to authenticate a server.
Syntax
public enum SSLProtocol
Members
| Member | Description |
|---|---|
| Ssl3 | Specifies that SSL 3.0 is used. |
| Tls | Specifies that Transport Layer Security (TLS) 1.0 is used. |
| Tls11 | Specifies that Transport Layer Security (TLS) 1.1 is used. |
| Tls12 | Specifies that Transport Layer Security (TLS) 1.2 is used. |
| Tls13 | Specifies that Transport Layer Security (TLS) 1.3 is used. |
| Default | Specifies that the default protocol is used. This is typically the highest version of TLS that is supported by the operating system. |
Remarks
The SSLProtocol enumeration is used to specify which security protocols are allowed when establishing a secure connection with the SslStream class.
When you set the EnabledSslProtocols property of an SslStream object, you can use a bitwise OR operation to combine multiple protocol values. For example, to enable both TLS 1.2 and TLS 1.3:
sslStream.EnabledSslProtocols = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls13;
It is recommended to use the latest supported TLS versions for enhanced security. Avoid using older protocols like SSL 3.0 and TLS 1.0 unless absolutely necessary for backward compatibility with legacy systems. The Default value is generally the safest choice as it adapts to the highest supported protocol version by the underlying operating system.
Requirements
| Component | Version |
|---|---|
| .NET Framework | 4.0 or later |
| .NET Standard | 2.0 or later |
| .NET Core | 2.0 or later |