Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

tcp

ssl

client

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.

like image 584
flavour404 Avatar asked Jun 02 '09 00:06

flavour404


People also ask

What is SSL in TCP IP?

TCP/IP (SSL) is a collection of specialized communications protocols and functions organized into a stack of the following layers. Each layer provides services to the layer above it and uses the services below it.

Does TCP use SSL?

SSL/TLS typically runs on top of TCP, but there is nothing to stop you from running it on UDP, SCTP or any other transport layer protocol. As a matter of fact HTTPS over TCP and UDP are both defined as "well known" by IANA and have reserved port numbers.

What is the difference between TCP and SSL?

Based on our experiments, we make a conclusion that TCP with SSL is more secure, compared with TCP connection which provides reliable, ordered, error-check delivery of a stream between server and client. Due to encrypt and decrypt data, transmission speed is more slow than normal.

Is TCP IP encrypted?

TLS/SSL provides secure (encrypted) communication between a remote client and a TCP/IP application server. Under TLS protocol, the application server is always authenticated.


1 Answers

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.

like image 155
Reed Copsey Avatar answered Sep 21 '22 18:09

Reed Copsey