private void Secure(Action success, Action <Exception> error) { var networkStream = new NetworkStream(_client); _clientSslStream = new SslStream(networkStream, false, RemoteCertificateValidationCallback); var clientAuthentication = _clientSslStream.BeginAuthenticateAsClient("localhost", null, null); var cert = new System.Security.Cryptography.X509Certificates.X509Certificate2("local.pfx", "local"); _wrapper.Authenticate(cert, RemoteCertificateValidationCallback, success, error); }