소스 검색

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