-1

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!

user185813
  • 481
  • 1
  • 5
  • 16
  • [Does this answer your question?](https://learn.microsoft.com/en-us/dotnet/api/system.net.security.sslstream?redirectedfrom=MSDN&view=netcore-3.1) – aepot Jul 19 '20 at 16:09
  • That's what I used to write my code, but it doesn't explain how to create the certificates – user185813 Jul 19 '20 at 22:18

1 Answers1

0

I figured this out. You can use a purchased certificate or just a self signed certificate

user185813
  • 481
  • 1
  • 5
  • 16