arbme
arbme

Reputation: 4931

Adding SSL to TcpListen server?

I have made a simple server using TcpListener and it works great but now I would like the connection to be secure.

The clients that connect would be web servers so does it matter if the certificate is trusted or is that just for web browsers?

I have found muddled answers that are not straight forward!

UPDATED

When I share this application would the user have to make a certificate as well or could all users use the same one? Would using the same one not cause security issues or can you bind the certificate to the application so it cannot be seen?

In other words whats the best practise?

Upvotes: 16

Views: 19005

Answers (1)

Remus Rusanu
Remus Rusanu

Reputation: 294257

Use SslStream class:

Typically, the SslStream class is used with the TcpClient and TcpListener classes. The GetStream method provides a NetworkStream suitable for use with the SslStream class.

There is a full example on the link.

Upvotes: 19

Related Questions