views:

29

answers:

1

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

Ok thanks so far please bare with me. So when I share this application would the user have to make a certificate aswell 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?

Thanks

+1  A: 

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.

Remus Rusanu