runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Error when using client certificate on .NET Core 2.0

Open Danvlz opened this issue 8 years ago • 7 comments

I need to connect with REST API using client certificate. I was able to do that on .NET Core 1.0, but now when I've migrated to .NET Core 2.0 I'm getting this error:

The handler does not support client authentication certificates with this combination of libcurl (7.51.0) and its SSL backend ("NSS/3.28.4") Module "System.Net.Http.CurlHandler+SslProvider", line 28, col 0, in SetSslOptionsForUnsupportedBackend Void SetSslOptionsForUnsupportedBackend(EasyRequest, ClientCertificateProvider) Module "System.Net.Http.CurlHandler+SslProvider", line 196, col 0, in SetSslOptions Void SetSslOptions(EasyRequest, System.Net.Http.ClientCertificateOption) Module "System.Net.Http.CurlHandler+EasyRequest", line 208, col 0, in InitializeCurl

Code is deployed on Unix environment (AWS Lambda). I've posted this issue here as well: https://github.com/aws/aws-lambda-dotnet/issues/221

Danvlz avatar Feb 05 '18 13:02 Danvlz

This looks related to https://github.com/dotnet/corefx/issues/24232

vellozzi avatar Feb 05 '18 22:02 vellozzi

Using client certificates on Linux in .NET Core <= 2.0 requires a libcurl built against OpenSSL. The error is saying the libcurl being used is built against NSS instead.

stephentoub avatar Feb 07 '18 00:02 stephentoub

@stephentoub What is solution then?

Danvlz avatar Feb 07 '18 09:02 Danvlz

What is solution then?

For .NET Core 2.0 and earlier, using a libcurl built against OpenSSL, e.g. one installed from a package manager if available, one built from source, etc. HttpClient on .NET Core 2.0 and earlier on Unix is built on libcurl, and to enable client certificates, the features we need are only available when using libcurl with an OpenSSL backend, because System.Security.Cryptography.X509Certificates uses OpenSSL. In .NET Core 2.1, we plan to have an implementation that doesn't require libcurl.

stephentoub avatar Feb 07 '18 10:02 stephentoub

That's good. Do we have an ETA for .NET Core 2.1 public release? BTW, this problem is particular hard to solve for Lambda functions running in AWS as we are also depending on AWS to support the latest version of .NET Core. Historically AWS takes a while to enable support for the latest version of .NET Core.

TomYip avatar Feb 09 '18 19:02 TomYip

Here's official .NET Core 2.1 roadmap: https://github.com/dotnet/core/blob/master/roadmap.md#upcoming-ship-dates (more details are not published yet)

karelz avatar Feb 09 '18 20:02 karelz

The question seems to be answered. .NET Core 2.1 will support a new default HTTP stack (SocketsHttpHandler) that won't have this restriction regarding the use of client TLS/SSL certificates.

davidsh avatar Mar 22 '18 20:03 davidsh