简体   繁体   中英

Simple client/server, TCP/IP encrypting the message stream, SSL

Writing a little TCP/IP client server app. Basically it creates a server, and then you can create several different clients and set up a bit of a chat session. What I am wondering is there is any way to incorporate, using standard .net libraries some form of encryption?

m_mainSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

Is there any way of speficying tcp using rsa?

Or would you (me that is) have to write some custom libaries to do key exchange and then encrypt the subsequent chat messages? I have done that before for uni but that was in java but I know it would'nt be hard to convert them. Just trying not to have to reinvent the wheel...

Or what about utilising a ssl?

Thanks, Ron.

The simplest way to encrypt your communication would be to just wrap the entire socket stream in a SslStream .

This is made to work directly with TcpClient/TcpListener, so it's very easy to encrypt a data stream using this.

只需将其包装在库中,或者将其包装在SSL隧道应用程序中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM