C# - secure `sockets` with SSL

20,743

You could use an SslStream. The documentation link contains an example of a TCP server and a client which communicate over SSL.

Share:
20,743
Sudantha
Author by

Sudantha

Interested in Web application development specially in PHP , Cryptography

Updated on November 16, 2020

Comments

  • Sudantha
    Sudantha over 3 years

    hi i have a socket connection (server) developed with methods available in

    using System.Net.Sockets;
    using System.Net;
    

    is it possible to secure the data communication in this sockets ? specially implement SSL ? any examples ?

  • Darin Dimitrov
    Darin Dimitrov almost 13 years
    @Sudantha, no, it works with bare sockets as well, but you probably shouldn't be using bare sockets anyway. SslStream can be used to wrap any Stream object, no matter where it comes from.
  • Sudantha
    Sudantha almost 13 years
    do u have any example with sslstream ? my client is on PHP is it possible ?
  • Darin Dimitrov
    Darin Dimitrov almost 13 years
    @Sudantha, isn't the link provided in the documentation insufficient for you to implement the server side? As far as the client side is concerned, I am not familiar with PHP, but I guess that if it supports SSL over TCP sockets that would work (as I don't know PHP I cannot point you towards good examples of how to achieve this). You will need a certificate on the server.