瀏覽代碼

禁用已过时的tls

陈国伟 4 年之前
父節點
當前提交
3c1ceba49e
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      FastGithub.Http/HttpClientHandler.cs

+ 2 - 0
FastGithub.Http/HttpClientHandler.cs

@@ -8,6 +8,7 @@ using System.Net;
 using System.Net.Http;
 using System.Net.Http;
 using System.Net.Security;
 using System.Net.Security;
 using System.Net.Sockets;
 using System.Net.Sockets;
+using System.Security.Authentication;
 using System.Security.Cryptography.X509Certificates;
 using System.Security.Cryptography.X509Certificates;
 using System.Threading;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -172,6 +173,7 @@ namespace FastGithub.Http
                     var sslStream = new SslStream(stream, leaveInnerStreamOpen: false);
                     var sslStream = new SslStream(stream, leaveInnerStreamOpen: false);
                     await sslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions
                     await sslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions
                     {
                     {
+                        EnabledSslProtocols = SslProtocols.Tls12 | SslProtocols.Tls13,
                         TargetHost = requestContext.TlsSniPattern.Value,
                         TargetHost = requestContext.TlsSniPattern.Value,
                         RemoteCertificateValidationCallback = ValidateServerCertificate
                         RemoteCertificateValidationCallback = ValidateServerCertificate
                     }, cancellationToken);
                     }, cancellationToken);