2

假设我做这样的典型事情:

HttpRequestMessage requestMessage = new HttpRequestMessage();
requestMessage.RequestUri = new Uri("https://api.site.com/");
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
Task<HttpResponseMessage> responseMessage = httpClient.SendAsync(requestMessage);

API 服务告诉我,由于 POODLE 漏洞,他们正在关闭 SSL 3.0,我是否必须对我的代码做任何事情以确保它会使用 TLS?发出请求的机器是否需要发生任何事情?

我知道这个问题有很多无知,但我认为很多开发人员只是希望回答这个问题。

4

1 回答 1

2

I faced same issue for Facebook and twitter yesterday and Linkedin from today. Added the following piece of code before every web request worked for me.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

It was lot confusing as on restarting the application, it worked for 10-15 mins before the first error. Following was the error logged.

System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel. 

I tried powershell script to disable ssl and enable tls in the server using http://www.hass.de/content/setup-your-iis-ssl-perfect-forward-secrecy-and-tls-12

It did not work and finally had to change the code to make it work.

于 2014-10-17T12:00:22.900 回答