21035

Enabling encryption in .NET sockets

I'm new to C# development.

In PHP we use

stream_socket_enable_crypto($fp, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);

What is its equivalent in C#?

Answer1:

SSLStream appears to do what you want

var tcp = new TcpClient(machineName,443); var ssl = new SslStream(tcp.GetStream);

You can specify a callback for doing certification validation. Otherwise it appears to default to the system's policy ( which I believe is what I.E. also uses by default)

Recommend

  • How to create SSLStream which uses Ssl3 instead of Tls
  • The client and server cannot communicate, because they do not possess a common algorithm, C# SslStre
  • Does .NET support TLS-PSK?
  • How iperf calculates network statistics
  • PDO connection to MySQL database refused
  • Cannot log in using SQL authentication ONLY from a remote server
  • rselenium | get youtube page source
  • JAXB Root Class Rename using binding.xml
  • My PHP code is commented out
  • How can I set the buffer size for the underneath Socket UDP?
  • Updating the composer.phar on Symfony2
  • linux — concurrently reading/writing from/to a file [closed]
  • import error with python-mysql-connector 1.16, django 1.6, and python 3.2.3
  • Django and Heroku: Static files work with 'foreman start' but not './manage.py runser
  • How can you tell if a Python program has anything to read from stdin?
  • Development workflow for server and client using Docker Compose?
  • getting domain details and portrait_id and landscape_id for openX
  • Installing SSL on AWS EC2 Bitnami Mean Stack
  • composer dependency stating in doesn't have php-xsl
  • Checking a play current mode makes an error occur
  • How can I see a list of all files that are different between two Hg repositories?
  • force json_encode to create strings
  • Converter from SAT to 3-SAT
  • Excel VBA How to populate a multi-dimensional (3d) array with values from multiple excel ranges?
  • How to implement Deep Linking in Roku SG application?
  • using html data-attributes as css-variable (i.e. text-shadow)
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • How to autopopulate a field in SugarCRM form
  • perl, mysql - fasting way to upload a csv file into mysql?
  • Differences in dis-assembled C code of GCC and Borland?
  • MonoTouch: How to download pdf incrementally as indicated in the Apple slides “Building Newsstand Ap
  • Installing iPhone App to iPhone
  • Get one-time binding to work for ng-if
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Is there any way to access browser form field suggestions from JavaScript?
  • Do I've to free mysql result after storing it?
  • Arrays break string types in Julia
  • A cron job substitute?
  • json Serialization in asp
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)