I'm trying to encrypt the data going over a socket connection. I am developing a server and the client software, which I will be distributing. I'm using TcpClient in .NET for my socket connections. Is the best way to do this to use a SSLStream? I have tried implementing the code for this but am having trouble understanding how the certificates work, and am getting a handshaking error when I tried creating my own certificates.
Does the client have to use a certificate in addition to the server? If it does, where do you store the certificate when you distribute the application? I'm assuming I wouldn't want to put it in the same directory as the application? Can I use self signing certificates for production? If not, would I just buy the same type of SSL cert that I would buy for a website? Does the client and server use different certificates? If so what do you do differently when generating or buying a client vs. server certificate?
Or are there better/easier ways to encrypt my data?
Thanks!