gpt4 book ai didi

c# - 如何创建使用 Ssl3 而不是 Tls 的 SSLStream

转载 作者:太空宇宙 更新时间:2023-11-03 13:27:06 26 4
gpt4 key购买 nike

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

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

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

ss.ReadTimeout = ss.WriteTimeout = timeout;

ss.AuthenticateAsClient(host);

var pp = ss.SslProtocol;

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

在HttpWebRequest中,你可以使用下面的代码来改变协议(protocol):

ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

我查过了,对SslStream没有影响。

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

最佳答案

您只需使用 AuthenticateAsClient 重载来指定应允许哪些协议(protocol):

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

关于c# - 如何创建使用 Ssl3 而不是 Tls 的 SSLStream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24676881/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com