当前位置: 首页>>代码示例>>C#>>正文


C# SslPolicyErrors.ToString方法代码示例

本文整理汇总了C#中SslPolicyErrors.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SslPolicyErrors.ToString方法的具体用法?C# SslPolicyErrors.ToString怎么用?C# SslPolicyErrors.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SslPolicyErrors的用法示例。


在下文中一共展示了SslPolicyErrors.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnValidationCallback

        public bool OnValidationCallback(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors)
        {
            if (errors.ToString() != "None")
            {
                MessageBox.Show("Please click yes on the next dialog box.\nThis will allow us to install the Net7 certificate.", "Certificate Install",
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                try
                {
                    X509Store Certificate = new X509Store(StoreName.Root);

                    X509Certificate2 cert2 = new X509Certificate2(cert);

                    Certificate.Open(OpenFlags.ReadWrite);

                    // Add Certificate
                    Certificate.Add(cert2);
                    Certificate.Close();
                }
                catch (Exception e)
                {
                    MessageBox.Show("Error installing certificate: " + e.ToString());
                }
            }
            else
            {
                MessageBox.Show("Certificate is installed!");
            }

            // Remove this message
            ServicePointManager.ServerCertificateValidationCallback = null;

            return true;
        }
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:34,代码来源:FormMain.cs

示例2: CertificateValidationCallback

 private static bool CertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
 {
     bool ok = true;
     if(sslPolicyErrors != SslPolicyErrors.None)
     {
         Console.WriteLine("SSL Certificate Validation Error!........");
         Console.WriteLine(sslPolicyErrors.ToString());
         ok = false;
     }
     return ok;
 }
开发者ID:Siryu,项目名称:Distributed-Processing-Capstone,代码行数:11,代码来源:SSLTest.cs

示例3:

		private static bool ValidateServerCertificate
			(Object sender, X509Certificate certificate,
			 X509Chain chain, SslPolicyErrors sslPolicyErrors)
		{
			if (sslPolicyErrors == SslPolicyErrors.None)
				return true;
			else
			{
				//TODO:Potential for options for certificate validation!
#if DEBUG_CRYPTO
				Console.Error.WriteLine(String.Format("Invalid Cert {0}: {1}",certificate.Subject,sslPolicyErrors.ToString()));
#endif
				return true;
			}
		}  
开发者ID:Meticulus,项目名称:tactical,代码行数:15,代码来源:http_function.cs

示例4: ValidateRemoteCertificate

        private bool ValidateRemoteCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors != SslPolicyErrors.None)
            {
                Console.WriteLine("SSL Certificate Validation Error!");
                Console.WriteLine(sslPolicyErrors.ToString());
                Console.WriteLine("Chain status:");
                foreach (var s in chain.ChainStatus)
                {
                    Console.WriteLine("\t" + s.Status + " : " + s.StatusInformation);
                }
                return false;
            }

            return true;
        }
开发者ID:sandeeplocality,项目名称:UG12Server,代码行数:16,代码来源:AsyncSecureSocketServerTest.cs

示例5: ValidateServerCertificate

 public static bool ValidateServerCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
 {
     Debug.LogWarning ("SSL Cert Error:" + sslPolicyErrors.ToString ());
     return true;
 }
开发者ID:xfanhsl,项目名称:IL2CPP_Test,代码行数:5,代码来源:IL2CPPCompatible.cs

示例6: ValidateServerCertificate

        public static bool ValidateServerCertificate (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
#if !UNITY_EDITOR
            System.Console.WriteLine( "NET: SSL Cert: " + sslPolicyErrors.ToString() );
#else
            Debug.LogWarning("SSL Cert Error: " + sslPolicyErrors.ToString ());
#endif
            return true;
        }
开发者ID:jquentin,项目名称:LaserPin,代码行数:9,代码来源:Request.cs

示例7: ValidateRemoteCertificate

        /// <summary>
        /// Certificate validation callback.
        /// </summary>
        private static bool ValidateRemoteCertificate(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors error)
        {
            // If the certificate is a valid, signed certificate, return true.
            if (error == System.Net.Security.SslPolicyErrors.None)
            {
                return true;
            }

            Console.WriteLine("X509Certificate [{0}] Policy Error: '{1}'",
                cert.Subject,
                error.ToString());

            return false;
        }
开发者ID:jinrenlab,项目名称:server-sdk-dotnet,代码行数:17,代码来源:RongHttpClient.cs

示例8: ValidateServerCertificate

        private static bool ValidateServerCertificate(
            object sender,
            X509Certificate certificate,
            X509Chain chain,
            SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors != SslPolicyErrors.None)
            {
                Debug.WriteLine("SOCKET: Certificate error: {0}", sslPolicyErrors.ToString());
                return false;
            }

            Debug.WriteLine("SOCKET: No Certificate errors.");
            return true;
        }
开发者ID:reicheltp,项目名称:KittyHawkMQ,代码行数:15,代码来源:Win32SocketAdapter.cs

示例9: ValidateRemoteClientCertificate

        /////////////////////////////////////////////////////
        //                                                 //
        // ValidateRemoteClientCertificate()               //
        //                                                 //
        /////////////////////////////////////////////////////
        //Description:  enforces SSL certificate validation
        //              rules as chosen by user.
        //
        //Returns:      true if valid
        /////////////////////////////////////////////////////
        internal bool ValidateRemoteClientCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            //yay, no errors.
            if (sslPolicyErrors == SslPolicyErrors.None)
                return true;

            WriteConnectionLog("CONNECT:  Detected SSL policy errors:  " + sslPolicyErrors.ToString());

            //ignore name mismatch errors in certificate?
            if (sslPolicyErrors == SslPolicyErrors.RemoteCertificateNameMismatch)
                //if (this.IgnoreRemoteCertIgnoreNameMismatchError)
                    return true;

            //ignore chain errors in certificate?
            if (sslPolicyErrors == SslPolicyErrors.RemoteCertificateChainErrors)
                //if (this.IgnoreRemoteCertIgnoreChainErrors)
                    return true;

            //refuse communication
            return false;
        }
开发者ID:kumaraguruv,项目名称:codeword,代码行数:31,代码来源:SslTcpServer.cs

示例10: ServicePointManager_ServerCertificateValidationCallback

        private bool ServicePointManager_ServerCertificateValidationCallback(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors != SslPolicyErrors.None)
            {
                Trace.TraceWarning("Certification error found: {0}", sslPolicyErrors.ToString());
                return ConfigurationAccessor.IgnoreCertificationError;
            }

            return true;
        }
开发者ID:rkttu,项目名称:webping,代码行数:10,代码来源:WebPingService.cs

示例11: OnCertificateValidation

        private static bool OnCertificateValidation(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors)
        {
            Console.WriteLine("Server Certificate Issued To: {0}", certificate.Subject);

            Console.WriteLine("Server Certificate Issued By: {0}", certificate.Issuer);

            // Return true if there are no policy errors

            // The certificate can also be manually verified to

            //make sure it meets your specific // policies by

            //   interrogating the x509Certificate object.

            if (errors != SslPolicyErrors.None) {

                Console.WriteLine("Server Certificate Validation Error");

                Console.WriteLine(errors.ToString());

                return false;

            }

            else {

                Console.WriteLine("No Certificate Validation Errors");

                return true;

            }
        }
开发者ID:404rq,项目名称:WalrusPad,代码行数:32,代码来源:SFTP.cs

示例12: ServerCertificateValidationCallback

 private bool ServerCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
 {
     var msg = string.Format(CultureInfo.InvariantCulture, "Validating SSL with an ignore setting of ({0})", this.ignoreSslErrors);
     this.LogMessage(msg, Severity.Informational, Verbosity.Detailed);
     msg = string.Format(CultureInfo.InvariantCulture, "Current Result: ({0})", sslPolicyErrors.ToString());
     this.LogMessage(msg, Severity.Informational, Verbosity.Detailed);
     if (sslPolicyErrors == SslPolicyErrors.None)
     {
         return true;
     }
     return this.ignoreSslErrors;
 }
开发者ID:RossMerr,项目名称:azure-sdk-for-net,代码行数:12,代码来源:HttpClientAbstraction.cs

示例13: ValidateServerCertificate

        private bool ValidateServerCertificate(object sender,
                                               X509Certificate certificate,
                                               X509Chain chain,
                                               SslPolicyErrors sslPolicyErrors)
        {
            Tracer.DebugFormat("ValidateServerCertificate: Issued By {0}", certificate.Issuer);
            if(sslPolicyErrors == SslPolicyErrors.None)
            {
                return true;
            }

            Tracer.WarnFormat("Certificate error: {0}", sslPolicyErrors.ToString());
            if(sslPolicyErrors == SslPolicyErrors.RemoteCertificateChainErrors)
            {
                Tracer.Error("Chain Status errors: ");
                foreach( X509ChainStatus status in chain.ChainStatus )
                {
                    Tracer.Error("*** Chain Status error: " + status.Status);
                    Tracer.Error("*** Chain Status information: " + status.StatusInformation);
                }
            }
            else if(sslPolicyErrors == SslPolicyErrors.RemoteCertificateNameMismatch)
            {
                Tracer.Error("Mismatch between Remote Cert Name.");
            }
            else if(sslPolicyErrors == SslPolicyErrors.RemoteCertificateNotAvailable)
            {
                Tracer.Error("The Remote Certificate was not Available.");
            }

            // Configuration may or may not allow us to connect with an invliad broker cert.
            return AcceptInvalidBrokerCert;
        }
开发者ID:Redi0,项目名称:meijing-ui,代码行数:33,代码来源:SslTransport.cs

示例14: APNSCertificateException

 public APNSCertificateException(SslPolicyErrors sslPolicyErrors)
     : base(sslPolicyErrors.ToString())
 {
     this.sslPolicyErrors = sslPolicyErrors;
 }
开发者ID:smoak,项目名称:libAPNs,代码行数:5,代码来源:APNSCertificateException.cs

示例15: CertificateValidationCallBack

        private bool CertificateValidationCallBack(object sender,
                                                   X509Certificate certificate,
                                                   X509Chain chain,
                                                   SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors != SslPolicyErrors.None)
            {
                Failure(String.Format("Certificate errors: {0}", sslPolicyErrors.ToString()), Url.AbsoluteUri);
                return false;
            }

            DateTime expirationTime;
            if (DateTime.TryParse(certificate.GetExpirationDateString(), out expirationTime))
            {
                TimeSpan expiringIn = expirationTime - DateTime.UtcNow;
                if (expiringIn < TimeSpan.FromDays(10))
                {
                    Degraded(String.Format("Certificate is about to expire! Expiration Date: {0}", expirationTime), Url.AbsoluteUri);
                }
                Success(String.Format("Certificate is ok. Expiring in {0} days.", (int)expiringIn.TotalDays), Url.AbsoluteUri);
            }
            else
            {
                Failure(String.Format("Unable to parse certificate expiration date. Expiration value: " + certificate.GetExpirationDateString()));
            }
            return true;
        }
开发者ID:bhuvak,项目名称:NuGetOperations,代码行数:27,代码来源:HttpMonitor.cs


注:本文中的SslPolicyErrors.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。