一、http://www.mono-project.com/FAQ:_Security
1、inux本身在發行的時候是不帶任何認證的,這和windows平台似乎恰恰相反。不過有工具,允許我們自行安裝認證。
mozroots --import / ##匯入認證
--ask-remove / ##僅刪除時確認
--machine ##儲存在全域環境
mozroots --import --sync
或者手動加入認證
certmgr -ssl https://t.open.com
2是直接在程式中加入代碼預設此https協議是正確的
using System;using System.Security.Cryptography.X509Certificates;namespace SSLtest{ class MainClass { // callback used to validate the certificate in an SSL conversation private static bool ValidateRemoteCertificate( object sender, X509Certificate certificate, X509Chain chain, System.Net.Security.SslPolicyErrors policyErrors ) { return true; /* if (Convert.ToBoolean(ConfigurationManager.AppSettings["IgnoreSslErrors"])) { // allow any old dodgy certificate... return true; } else { return policyErrors == SslPolicyErrors.None; } */ } // End Function ValidateRemoteCertificate public static void Main (string[] args) { //System.Net.ServicePointManager.ServerCertificateValidationCallback += ValidateRemoteCertificate; System.Net.ServicePointManager.ServerCertificateValidationCallback += (s,ce,ca,p) => true; string strResponse = null; try { System.Net.WebRequest request = System.Net.HttpWebRequest.Create("https://encrypted.google.com/"); System.Net.HttpWebResponse response = (System.Net.HttpWebResponse) request.GetResponse(); System.IO.Stream stream = response.GetResponseStream(); System.IO.StreamReader sr = new System.IO.StreamReader(stream); strResponse = sr.ReadToEnd(); sr.Close(); sr.Dispose(); stream.Dispose(); } catch(System.IO.IOException ex) { Console.WriteLine("Failed to connect to URI"); Console.WriteLine("Reason:"); Console.WriteLine(ex.Message); Console.WriteLine(Environment.NewLine); Console.WriteLine("Stacktrace:"); Console.WriteLine(ex.StackTrace); } catch(System.UriFormatException ex) { Console.WriteLine("Bad URI format"); Console.WriteLine("Reason:"); Console.WriteLine(ex.Message); Console.WriteLine(Environment.NewLine); Console.WriteLine("Stacktrace:"); Console.WriteLine(ex.StackTrace); } Console.WriteLine ("Read the following stream:"); Console.WriteLine(strResponse); Console.WriteLine(Environment.NewLine); Console.WriteLine(" --- Press any key to continue --- "); Console.ReadKey(); } // End Sub Main } // End Class MainClass } // End Namespace SSLtest