How to create SSLStream which uses Ssl3 instead of Tls

心已入冬 提交于 2019-12-11 08:09:08

问题


I'm trying to establish tcp connection which is encrypted using Ssl3.

Basically I'm just creating TCP connection and than I'm creating SSLStream on top of that:

var ss = new SslStream(poolItem.SecureConnection, false, remoteCertificateValidationCallback);

ss.ReadTimeout = ss.WriteTimeout = timeout;

ss.AuthenticateAsClient(host);

var pp = ss.SslProtocol;

My problem is that by default SslStream uses TLS. I want for it to be Ssl3.

In HttpWebRequest, you can use following code to change the protocol:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

I checked it, and it doesn't affect SslStream.

How do I change SslStream's protocol to Ssl3?


回答1:


You just have to use the AuthenticateAsClient overload that lets you specify which protocols should be allowed:

AuthenticateAsClient
  (host, new X509CertificateCollection(), SslProtocols.Ssl3, false);


来源:https://stackoverflow.com/questions/24676881/how-to-create-sslstream-which-uses-ssl3-instead-of-tls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!