Skip to content

SSL Connection Error with Wildcard Certificates and Underscores #35880

@michaelfletchercgy

Description

@michaelfletchercgy

The DotNetCore TLS certificate validation will return an error when accessing a host with an underscore in its name and a wildcard certificate.

For example https://preprod_curve.curvehero.net/ fails with an SSL connection using the .NET Core WebClient. It works nearly everywhere else including ...

  • Firefox
  • Chrome
  • Safari
  • Curl
  • OpenSSL

This code would repro the problem

var wc = new System.Net.WebClient();
wc.DownloadFile("https://preprod_curve.curvehero.net/", @"foo.txt");

I tested this on Linux and recently reproduced the issues with .net core 5 preview 3. I can work around the issue by setting DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER="0".

The error would be

 ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.
 ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
   at System.Net.Security.SslStream.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
   at System.Net.Security.SslStream.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
   at System.Net.Security.SslStream.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions