NativeOpenSsl.RemoteValidationCallback GetValidationCallback() { CertificateValidator validator = null; if (IsServer) { validator = (CertificateValidator)Parameters.ServerCertificateValidator; } else { validator = (CertificateValidator)Parameters.ClientCertificateValidator; } if (validator == null) { return(null); } return((ok, cert) => { var errors = SslPolicyErrors.None; if (!ok) { errors |= SslPolicyErrors.RemoteCertificateChainErrors; } return validator.ValidationCallback(this, cert, null, errors); }); }
internal static void AddCertificateValidator(MSI.MonoTlsSettings settings, CertificateValidator validator) { if (validator == null) { return; } settings.RemoteCertificateValidationCallback = (s, c, ch, e) => { return(validator.ValidationCallback(s, c, ch, (SslPolicyErrors)e)); }; }