-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client certificate not included by HttpClientHandler in .net core #26531
Comments
Did you try it on .NET Core 2.1? Which OS do you run on? |
Please check that your client certificate has the EKU of ClientAuthentication (or no EKU attribute at all). And please verify that it is not using SHA1. Violating these constraints may result in the HTTP stack ignoring your certificate and not sending it. |
I'm seeing this issue also. Client certificates are no longer being sent where they were being sent with libcurl. here's how i create my certs: https://gist.github.com/mtigas/952344 |
@janobrestad Could you post the exact steps you use to create your client certificate? And, if possible, could you attach the *.CER file of the client certificate? You can export it out of the certificate store. Please do not export the file as PFX, i.e. don't export the private key. Alternatively, please post a complete picture of all the X509v3 fields of the certificate. Here is a sample picture: |
.NET Core requires Key Usage attribute, if present, to have "Digital Signature" value.
We do have EventSource logging for .NET Core networking: However, we probably should add more logging for scenarios like this. cc: @bartonjs |
We have added more logging to help developers track why certain client certificates might not be sent to the server, dotnet/corefx#31168 |
It's been a while since this post, but I have the same issue, yet my certificate does have the Digital Signature value. |
@Caesar1995 Thanks. I have not. I am having a hard time following that article. There are many things that the article presupposes the reader already knows. I am quite lost. I just wonder why doesn't the application throw an exception if there is an issue with the certificate being used. |
The design of the .NET Core HTTP stack is to not throw exceptions for client certificates that don't match the required properties. The certificate is simply skipped and other possible client certificates are examined to see if they match. In order to diagnose this, you will need to take trace as described below. |
Also, in general, it is not good to comment on closed issues like this because they are not tracked. If you are having an issue with the current version of .NET Core, you should open a new issue and include all information necessary to reproduce the issue. |
@daflame76 Thanks. Will try to make the logs work. It is just not very clear. And thanks for the advice on closed issues. I just thought that since it was the same issue, it would be better to follow up as supposed to open a new one. |
It is better to open a new issue. Many times, the root cause is different despite the symptoms being similar. It is ok to reference the closed issue number in your new issue though. |
Guys, if you don't wanna use a certificate We pass to you, throw an exception, just don't ignore it and let us in the dark. |
@alcoforado: we do not actively monitor old issues. please open a new issue with your concern to ensure it gets attention and can be tracked. |
I have code in a .net Standard 2.0 project that uses HttpClientHandler to include a client certificate in the request.
It works perfectly when called from a console program running on .net 4.7.1, but if I run the code from a .net core console app the client certificate is not sent. There are no exceptions, no error messages, the client certificate is just not sent to the server.
To have a simple way of reproducing this I changed the default ValuesController in a new WebApi project (not .net core) to this.
Basically just returning the serialnumber of the client certificate or returning a BadRequest error if it is not included.
I then have this code in a .Net Standard 2.0 library:
The calling code on .net core and full framework is identitical:
The full framework version prints this:
While the output from the .net core version is:
Am I doing something wrong here? Or is there a bug in .net core?
The text was updated successfully, but these errors were encountered: