こんにちは、私はC#のSSLクライアント/サーバ通信をサーバとクライアント証明書を使って相互認証しています。私は、私はSSLクライアント/サーバ相互認証
AuthenticateAsClient(string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
メソッドを使用する必要があるだろうと仮定し、私はcorrentだ
TcpClient client = new TcpClient(machineName, port);
//Create an SSL stream that will close the client's stream.
SslStream sslStream = new SslStream(
client.GetStream(),
false,
new RemoteCertificateValidationCallback(ValidateServerCertificate),
null
);
try
{
// The server name must match the name on the server certificate.
sslStream.AuthenticateAsClient(serverName);
}
catch (AuthenticationException e)
{
Console.WriteLine("Exception: {0}", e.Message);
if (e.InnerException != null)
{
Console.WriteLine("Inner exception: {0}", e.InnerException.Message);
}
Console.WriteLine("Authentication failed - closing the connection.");
client.Close();
return;
}
:のみ、クライアント側で、私はそのようSTHを使用するサーバー証明書を使用して、SSL通信を行うために管理?誰もが周りのすべてのものでそれを使用する方法を私に見せてもらえますか?サーバー側でも、基本的な例を教えてください?
ありがとうございました。
あなたはWCFのフレームワークを使用するようにしようとしていない理由を私は求めることができますか?彼らは相互認証のオプションがあり、あなたのために多くの重労働をします。 [WCF documentation](http://msdn.microsoft.com/en-us/netframework/aa663324) – Jay