使用ServicePointManager.SecurityProtocol的线程安全 - 我需要专家的建议 [英] Thread safety using ServicePointManager.SecurityProtocol -- I need experts' advice

查看:712
本文介绍了使用ServicePointManager.SecurityProtocol的线程安全 - 我需要专家的建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个系统,其中单独的线程通过HTTPS连接到不同的服务器。

我需要连接的远程服务器之一非常愚蠢(Oracle App Server-10g),并要求我将安全协议降级为SSL3而不是TLS。
<我知道唯一可以使其工作的策略是在属性 SecurityProtocol <中设置值 SecurityProtocolType.Ssl3 ServicePointManager 类的/ span>。 (更多信息此处)。但也必须与其他需要Tsl安全协议的智能服务器并行处理。

问题
- 由于ServicePointManager是一个静态类,
- 并且由于我有几个线程同时从不同的Https服务器消费服务(一些使用Ssl3,一些使用Tls),
=>通过在静态 SecurityProtocol之间切换回来是否存在任何潜在的线程问题。 ServicePointManager Ssl3 Tls
=>设置值是 SecurityProtocol。 ServicePointManager "下划线,影响其他线程?

Corrolary 问题:
=>设置值是 SecurityProtocol。 ServicePointManager ,影响其他应用程序?

I'm writing a system in which separate threads connect to different servers over HTTPS.

One of the remote server I need to connect to is really dumb (Oracle App Server-10g) and requires me to downgrade the the Security-Protocol to SSL3 instead of the TLS.

The only strategy I know to make it work, is to set the value SecurityProtocolType.Ssl3 in the property SecurityProtocol of the ServicePointManager class. (more info here). But also have to deal in parallel with other smarter servers which are requiring Tsl secutity protocol.

Questions:
- since ServicePointManager is a static class,
- and since I have several threads consumings services from different Https servers at the same time (some with Ssl3, some with Tls),
=> is there any potential threading problem by switching back in forth between static SecurityProtocol.ServicePointManager from Ssl3 to Tls?
=> does setting a value is SecurityProtocol.ServicePointManager in one thread, impact the other threads?

Corrolary Question:
=> does setting a value is SecurityProtocol.ServicePointManager in one application, impact the other applications?

推荐答案

SecurityProtocolType枚举
http://msdn.microsoft。 com / zh-cn / library / system.net.securityprotocoltype.aspx 是Flags属性,因此您可以将其设置为同时使用它们。在SSL握手中,客户端将宣传它支持这两种协议,并且它将从服务器广告中选择最强的协议。
The SecurityProtocolType enumeration
http://msdn.microsoft.com/en-us/library/system.net.securityprotocoltype.aspx is a Flags attribute, so you can set it to use both. In the SSL Handshake, the client will advertise that it supports both protocols, and it will chose the strongest from those advertised by the server.


这篇关于使用ServicePointManager.SecurityProtocol的线程安全 - 我需要专家的建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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