csharp-leaf / Leaf.xNet

HTTP Library. Impoved original xNet.
https://github.com/csharp-leaf
182 stars 53 forks source link

Problem with Tls13 #85

Open thanh858036 opened 4 years ago

thanh858036 commented 4 years ago

i use netframework 4.8 and set httpRequest.SslProtocols = SslProtocols.Tls13 and it error Win32Exception: The client and server cannot communicate, because they do not possess a common algorithm

grandsilence commented 4 years ago

Is server supports TLS 1.3?

thanh858036 commented 4 years ago

Is server supports TLS 1.3?

yes website use TLS 13 manga1001.com

cod3d commented 3 years ago

same issue with instagram

grandsilence commented 3 years ago

Windows 10 2004 Release or lower? NT Kernel should support TLS 1.3.

thanh858036 commented 3 years ago

Windows 10 2004 Release or lower? NT Kernel should support TLS 1.3.

i used win 10 ver 1909

cod3d commented 3 years ago

Fixed already. I changed target framework to 4.8 and set SslProtocols here: click to public SslProtocols SslProtocols { get; set; } = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13;

Then go to click and changed to sslStream.AuthenticateAsClient(address.Host, new X509CertificateCollection(), SslProtocols, true);

also I changed from click to ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;

After all this I recompiled the Leaf library and it works fine!

thanh858036 commented 3 years ago

Fixed already. I changed target framework to 4.8 and set SslProtocols here: click to public SslProtocols SslProtocols { get; set; } = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12 | SslProtocols.Tls13;

Then go to click and changed to sslStream.AuthenticateAsClient(address.Host, new X509CertificateCollection(), SslProtocols, true);

also I changed from click to ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;

After all this I recompiled the Leaf library and it works fine!

only worked with instagram not work with my site Unable to establish SSL-connection with HTTP-server

Zeokat commented 3 years ago

Same problem here, seems that the error is now present in many websites. Tryed to investigate the issue but i can't find how to solve this.

Zeokat commented 3 years ago

Maybe you can vote up my question at stackoverflow to try to solve this issue: https://stackoverflow.com/questions/64848260/problem-with-https-request-and-sslstream-on-some-sites