如何创建使用Ssl3而不是Tls的SSLStream [英] How to create SSLStream which uses Ssl3 instead of Tls

查看:221
本文介绍了如何创建使用Ssl3而不是Tls的SSLStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试建立使用Ssl3加密的tcp连接.

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

基本上,我只是创建TCP连接,然后在其之上创建SSLStream:

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;

我的问题是,默认情况下,SslStream使用TLS.我希望它是Ssl3.

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

在HttpWebRequest中,您可以使用以下代码来更改协议:

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

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

我检查了它,它不会影响SslStream.

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

如何将SslStream的协议更改为Ssl3?

How do I change SslStream's protocol to Ssl3?

推荐答案

您只需要使用AuthenticateAsClient重载,即可指定应该允许哪些协议:

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

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

这篇关于如何创建使用Ssl3而不是Tls的SSLStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆