Exemple #1
0
        private static bool ConfirmServerCertificate(Session oS, string sExpectedCN, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            CertificateValidity certificateValidity = CertificateValidity.Default;

            FiddlerApplication.CheckOverrideCertificatePolicy(oS, sExpectedCN, certificate, chain, sslPolicyErrors, ref certificateValidity);
            if (certificateValidity == CertificateValidity.ForceInvalid)
            {
                return(false);
            }
            if (certificateValidity == CertificateValidity.ForceValid)
            {
                return(true);
            }
            if ((certificateValidity != CertificateValidity.ConfirmWithUser && (sslPolicyErrors == SslPolicyErrors.None || CONFIG.IgnoreServerCertErrors)) || oS.oFlags.ContainsKey("X-IgnoreCertErrors"))
            {
                return(true);
            }
            if ((sslPolicyErrors & SslPolicyErrors.RemoteCertificateNameMismatch) == SslPolicyErrors.RemoteCertificateNameMismatch && oS.oFlags.ContainsKey("X-IgnoreCertCNMismatch"))
            {
                sslPolicyErrors &= ~SslPolicyErrors.RemoteCertificateNameMismatch;
                if (sslPolicyErrors == SslPolicyErrors.None)
                {
                    return(true);
                }
            }
            return(false);
        }
Exemple #2
0
        private static bool ConfirmServerCertificate(Session oS, string sExpectedCN, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            CertificateValidity oValidity = CertificateValidity.Default;

            SDVPApplication.CheckOverrideCertificatePolicy(oS, sExpectedCN, certificate, chain, sslPolicyErrors, ref oValidity);
            switch (oValidity)
            {
            case CertificateValidity.ForceInvalid:
                return(false);

            case CertificateValidity.ForceValid:
                return(true);
            }
            if ((oValidity == CertificateValidity.ConfirmWithUser) || ((sslPolicyErrors != SslPolicyErrors.None) && !Browser.IgnoreServerCertErrors))
            {
                return(false);
            }
            return(true);
        }
 internal static void CheckOverrideCertificatePolicy(Session oS, string sExpectedCN, X509Certificate ServerCertificate, X509Chain ServerCertificateChain, SslPolicyErrors sslPolicyErrors, ref CertificateValidity oValidity)
 {
     EventHandler<ValidateServerCertificateEventArgs> onValidateServerCertificate = OnValidateServerCertificate;
     if (onValidateServerCertificate != null)
     {
         ValidateServerCertificateEventArgs e = new ValidateServerCertificateEventArgs(oS, sExpectedCN, ServerCertificate, ServerCertificateChain, sslPolicyErrors);
         onValidateServerCertificate(oS, e);
         oValidity = e.ValidityState;
     }
 }
 internal static void CheckOverrideCertificatePolicy(Session oS, string sExpectedCN, X509Certificate ServerCertificate, X509Chain ServerCertificateChain, SslPolicyErrors sslPolicyErrors, ref CertificateValidity oValidity)
 {
     if (OnValidateServerCertificate != null)
     {
         ValidateServerCertificateEventArgs e = new ValidateServerCertificateEventArgs(oS, sExpectedCN, ServerCertificate, ServerCertificateChain, sslPolicyErrors);
         OnValidateServerCertificate(oS, e);
         oValidity = e.ValidityState;
     }
 }
Exemple #5
0
        internal static void CheckOverrideCertificatePolicy(Session oS, string sExpectedCN, X509Certificate ServerCertificate, X509Chain ServerCertificateChain, SslPolicyErrors sslPolicyErrors, ref CertificateValidity oValidity)
        {
            EventHandler <ValidateServerCertificateEventArgs> onValidateServerCertificate = FiddlerApplication.OnValidateServerCertificate;

            if (onValidateServerCertificate == null)
            {
                return;
            }
            ValidateServerCertificateEventArgs validateServerCertificateEventArgs = new ValidateServerCertificateEventArgs(oS, sExpectedCN, ServerCertificate, ServerCertificateChain, sslPolicyErrors);

            onValidateServerCertificate(oS, validateServerCertificateEventArgs);
            oValidity = validateServerCertificateEventArgs.ValidityState;
        }