• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class SmtpCertificateValidation

Provides SSL certificate validation callbacks for use with CertificateValidationCallback.

Inheritance
object
SmtpCertificateValidation
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Mail.Rfc.Smtp
Assembly: DRIT.Mail.dll
Syntax
public static class SmtpCertificateValidation

Methods

View Source

AcceptAll(object, X509Certificate?, X509Chain?, SslPolicyErrors)

Accepts any certificate, regardless of validity. This callback disables all certificate validation and should only be used in testing. Never use in production.

Declaration
public static bool AcceptAll(object sender, X509Certificate? certificate, X509Chain? chain, SslPolicyErrors sslPolicyErrors)
Parameters
Type Name Description
object sender
X509Certificate certificate
X509Chain chain
SslPolicyErrors sslPolicyErrors
Returns
Type Description
bool

Always true.

View Source

ValidateChainAndHostname(object, X509Certificate?, X509Chain?, SslPolicyErrors)

Validates the server certificate chain and hostname. This is the production-safe default. It accepts the certificate only when the platform has validated both the chain and the hostname match.

When SmtpClient calls AuthenticateAsClient(string) with the target hostname, the platform already checks that the certificate's Subject CN or Subject Alternative Names match the specified hostname. If everything passes, sslPolicyErrors will be None.

Declaration
public static bool ValidateChainAndHostname(object sender, X509Certificate? certificate, X509Chain? chain, SslPolicyErrors sslPolicyErrors)
Parameters
Type Name Description
object sender
X509Certificate certificate
X509Chain chain
SslPolicyErrors sslPolicyErrors
Returns
Type Description
bool

true if sslPolicyErrors is None; otherwise false.

  • View Source
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX