MSDN Library

Documentation for Microsoft Products

SslValidationResultCode Enum

This enumeration defines the possible results of an SSL validation operation.

Namespace:

System.Net.Security

Assembly:

System (in System.dll)

Syntax

public enum SslValidationResultCode

Members

The following table lists the members of the SslValidationResultCode enumeration:

Success The SSL certificate validation was successful.
InvalidSubjectName The subject name on the SSL certificate does not match the host name.
InvalidCertificateAuthority The SSL certificate was not issued by a trusted Certificate Authority.
Expired The SSL certificate has expired.
Revoked The SSL certificate has been revoked.
Untrusted The SSL certificate is from an untrusted source.
UnknownError An unknown error occurred during SSL certificate validation.

Remarks

When establishing an SSL/TLS connection, the client application often needs to validate the server's certificate. This enumeration provides a structured way to communicate the outcome of that validation process.

A value of Success indicates that the certificate is considered valid and trusted for the connection. Any other value signifies a problem with the certificate or the validation process, and the application should typically treat such connections as insecure.

Examples

The following C# code snippet demonstrates how to check the result of an SSL validation:

// Assuming 'validationResult' is a variable of type SslValidationResultCode if (validationResult == SslValidationResultCode.Success) { Console.WriteLine("SSL certificate validation successful."); } else { Console.WriteLine($"SSL certificate validation failed: {validationResult}"); }

Requirements

.NET Framework: Supported in versions 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.6, 4.7, 4.8.

.NET Core / .NET 5+: Supported.

Operating System: Windows 98, Windows Me, Windows 2000, Windows XP, Windows Server 2003, Windows Vista, Windows 7, Windows 8, Windows 10, Windows Server 2008, Windows Server 2012, Windows Server 2016, Windows Server 2019.