���using System; using System.Collections.Generic; using System.Text; using System.Net; using System.Net.Sockets; using System.Net.Security; using System.Security.Cryptography.X509Certificates; using System.Security.Authentication; namespace TorTests { class Program { private const string host = "81.223.215.102"; private const int port = 443; static void Main(string[] args) { using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { socket.Connect(host, port); using (var networkStream = new NetworkStream(socket)) using (var ssl = new SslStream(networkStream, false, CertificateValidation)) { var certificates = GetCollection(); ssl.AuthenticateAsClient(host, certificates, SslProtocols.Ssl3, false); } } } private static X509CertificateCollection GetCollection() { var collection = new X509CertificateCollection(); var certificate = new X509Certificate("TestServer.cer"); collection.Add(certificate); return collection; } private static bool CertificateValidation(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; } } }