Skip to content

Macos - HttpClient cannot handle TLS 1.3 #24489

Closed as duplicate
Closed as duplicate

Description

@lilleydnSub

Apple platform

macOS

Framework version

net10.0-, net9.0-

Affected platform version

.NET SDK 10.0.101 , 9.0.11

Description

A certain website is now using only supporting tls 1.3 and no longer 1.2, unfortunately dotnet on macos does not seem to handle it, but iOS does and Android.
iOS only works with <UseNativeHttpHandler>true</UseNativeHttpHandler> when set to false it fails.
Setting UseNativeHttpHandler on Mac has no effect.

using System.Net;

HttpClient aClient = new HttpClient();
var aResponse = aClient.GetAsync("https://meine.hanseaticbank.de");
aResponse.Wait();

// Expected result to get a webpage back
/* Actual result exception

handled exception. System.AggregateException: One or more errors occurred. (The SSL connection could not be established, see inner exception.)
 ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception.
 ---> Interop+AppleCrypto+SslException: bad protocol version
   --- End of inner exception stack trace ---
   at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](Boolean receiveFirst, Byte[] reAuthenticationData, CancellationToken cancellationToken)
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.InjectNewHttp11ConnectionAsync(QueueItem queueItem)
   at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.SocketsHttpHandler.<SendAsync>g__CreateHandlerAndSendAsync|115_0(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Program.<Main>$(String[] args) in /Users/davidlilley/macos/code/Subsembly_Banking/ConsoleApp2/Program.cs:line 7

Steps to Reproduce

I have attached 2 sample projects a Console Project and Macos Project.

Console App
ConsoleApp2.zip

Macos App
macOSApp1.zip

Did you find any workaround?

No response

Relevant log output

No response

Activity

  1. rolfbjarne commented on Jan 8, 2026

    @rolfbjarne
    Member

    Support for TLS 1.3 was added to .NET 10, but it's opt-in: https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-10/libraries#tls-13-for-macos-client.

    Setting the switch in your test apps makes it work:

    AppContext.SetSwitch("System.Net.Security.UseNetworkFramework", true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions