M
M
MIsternik2016-10-05 22:15:50
.NET
MIsternik, 2016-10-05 22:15:50

Could not create SSL/TLS secure channel. Why?

I am requesting a page using HttpWebRequest, the code is below.

HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.Headers.Add(HttpRequestHeader.AcceptEncoding, "gzip,deflate");
request.UserAgent = _userAgent;
request.AllowAutoRedirect = allowAutoRedirect;
request.Accept = "*/*";
request.Timeout = _timeout;
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3;

but for some sites with normal certificates I get:
The request was aborted: Could not create SSL/TLS secure channel.
No matter how much I google, they always refer to ServicePointManager.SecurityProtocol.
Has anyone met?
Script on Win Server 2012.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
spinacheyepressure, 2020-12-17
@spinacheyepressure

The reason may be that the OS does not have a cipher suite suitable for the server. This will also manifest itself in that the https link does not open in IE (which uses SChannel), but opens in Firefox/Chrome (which use their own SSL/TLS libraries).
I was unable to connect to api.telgram.org.
I tested the url on sslabs . In the configuration section, the report shows the protocols and cipher suites that can be used to build a secure connection.
From Win 2008 R2, I could not access telegram.org via TLS 1.3, only 1.2 remained, 5 cipher suites are available for it.
I checked with IISCrypto - I didn't have any of them, which is why the error was occurring.
Found on MS sitelist of supported OS cipher suites: the first three (TLS_ECDHE*) are not supported at all,
and the remaining two required update KB2992611 to be installed.
Win 2012/2012 R2 seems to have a similar situation and a similar solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question