internal bool Invoke(string hostName,
                             ServicePoint servicePoint,
                             X509Certificate certificate,
                             WebRequest request,
                             X509Chain chain,
                             SslPolicyErrors sslPolicyErrors)
        {
            PolicyWrapper policyWrapper = new PolicyWrapper(m_CertificatePolicy,
                                                            servicePoint,
                                                            (WebRequest)request);

            if (m_Context == null)
            {
                return(policyWrapper.CheckErrors(hostName,
                                                 certificate,
                                                 chain,
                                                 sslPolicyErrors));
            }
            else
            {
                ExecutionContext execContext     = m_Context.CreateCopy();
                CallbackContext  callbackContext = new CallbackContext(policyWrapper,
                                                                       hostName,
                                                                       certificate,
                                                                       chain,
                                                                       sslPolicyErrors);
                ExecutionContext.Run(execContext, Callback, callbackContext);
                return(callbackContext.result);
            }
        }
        internal bool Invoke(string hostName,
                             ServicePoint servicePoint,
                             X509Certificate certificate,
                             WebRequest request,
                             X509Chain chain,
                             SslPolicyErrors sslPolicyErrors)
        {
            PolicyWrapper policyWrapper = new PolicyWrapper(m_CertificatePolicy,
                                                            servicePoint,
                                                            (WebRequest) request);

            if (m_Context == null)
            {
                return policyWrapper.CheckErrors(hostName,
                                                 certificate,
                                                 chain,
                                                 sslPolicyErrors);
            }
            else
            {
                ExecutionContext execContext = m_Context.CreateCopy();
                CallbackContext callbackContext = new CallbackContext(policyWrapper,
                                                                      hostName,
                                                                      certificate,
                                                                      chain,
                                                                      sslPolicyErrors);
                ExecutionContext.Run(execContext, Callback, callbackContext);
                return callbackContext.result;
            }
        }
 internal bool Invoke(string hostName, ServicePoint servicePoint, X509Certificate certificate, WebRequest request, X509Chain chain, SslPolicyErrors sslPolicyErrors)
 {
     PolicyWrapper policyWrapper = new PolicyWrapper(this.m_CertificatePolicy, servicePoint, request);
     if (this.m_Context == null)
     {
         return policyWrapper.CheckErrors(hostName, certificate, chain, sslPolicyErrors);
     }
     ExecutionContext executionContext = this.m_Context.CreateCopy();
     CallbackContext state = new CallbackContext(policyWrapper, hostName, certificate, chain, sslPolicyErrors);
     ExecutionContext.Run(executionContext, new ContextCallback(this.Callback), state);
     return state.result;
 }
        internal bool Invoke(string hostName, ServicePoint servicePoint, X509Certificate certificate, WebRequest request, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            PolicyWrapper policyWrapper = new PolicyWrapper(this.m_CertificatePolicy, servicePoint, request);

            if (this.m_Context == null)
            {
                return(policyWrapper.CheckErrors(hostName, certificate, chain, sslPolicyErrors));
            }
            ExecutionContext executionContext = this.m_Context.CreateCopy();
            CallbackContext  state            = new CallbackContext(policyWrapper, hostName, certificate, chain, sslPolicyErrors);

            ExecutionContext.Run(executionContext, new ContextCallback(this.Callback), state);
            return(state.result);
        }