PDA

View Full Version : سوال: کسی هست با SslStream کار کرده باشه؟



amir001
یک شنبه 28 آذر 1389, 03:05 صبح
سلام

من نیاز پیدا کرده ام که یک سوکت لایه امن ایجاد کنم که برای این کار در سی شارپ SslStream را پیدا کردم که فکر میکنم برای ارسال و دریافت اطلاعات بر اساس X509 هست ، توی MSDN هم یک مثال ازش هست که همین کاری که من میخوام را انجام میده اما به درستی نفهمیدم چطوری کار میکنه.

http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx




public sealed class SslTcpServer
{
static X509Certificate serverCertificate = null;
// The certificate parameter specifies the name of the file
// containing the machine certificate.
public static void RunServer(string certificate)
{
serverCertificate = X509Certificate.CreateFromCertFile(certificate);
// Create a TCP/IP (IPv4) socket and listen for incoming connections.
TcpListener listener = new TcpListener(IPAddress.Any, 8080);
listener.Start();
while (true)
{
Console.WriteLine("Waiting for a client to connect...");
// Application blocks while waiting for an incoming connection.
// Type CNTL-C to terminate the server.
TcpClient client = listener.AcceptTcpClient();
ProcessClient(client);
}

}
......


آیا از دوستان کسی هست که با این کلاس کار کرده باشه و بدونه دقیقا چه مراحلی را باید طی کرد؟؟؟

ممنون میشم اگر پاسخ بدید.

amir001
دوشنبه 06 دی 1389, 13:31 عصر
یعنی هیچ برنامه نویسی اینجا نیست که یک بار از پروتوکل لایه امن استفاده کرده باشه؟؟؟؟؟؟