Bug 23075 - Not implemented WebRequestHandler.ClientCertificates makes it impossible to use custom SSL certs for HTTP requests on Mono
Summary: Not implemented WebRequestHandler.ClientCertificates makes it impossible to u...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: General (show other bugs)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-16 20:26 UTC by Ahmet Alp Balkan
Modified: 2015-11-18 02:11 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Ahmet Alp Balkan 2014-09-16 20:26:14 UTC
I'm using [Microsoft HTTP Client Libraries](https://www.nuget.org/packages/Microsoft.Net.Http) from NuGet and I'm basically trying to allow TLS authentication in HttpClient using X509Certificate2 certificates.


I have tried creating the client like this:

	WebRequestHandler certHandler = new WebRequestHandler () {
		ClientCertificateOptions = ClientCertificateOption.Manual,
		UseDefaultCredentials = false
	};
	certHandler.ClientCertificates.Add (this.ClientCertificate);
	HttpClient client = new HttpClient (certHandler);

However `certHandler.ClientCertificates` is failing because this getter is not implemented in Mono:

    https://github.com/mono/mono/blob/debdc1c1273402d43bccbe156ca608f7af6262f5/mcs/class/System.Net.Http.WebRequest/System.Net.Http.WebRequest/WebRequestHandler.cs#L84

This unimplemented part of the class makes it impossible to use custom client certificates in HTTP requests on Mono environment. This actually matters because some SDKs like

* Microsoft Azure Management Libraries for .NET https://www.nuget.org/packages/microsoft.windowsazure.management.libraries
* Amazon Web Services SDK for .NET http://aws.amazon.com/sdk-for-net/ [1]

uses customer-provided certificates to authenticate to the APIs. Therefore, custom SSL certificate handling is becoming more popular and it would be getter if that missing portion gets implemented.

(I also asked this as a StackOverflow question here: http://stackoverflow.com/questions/25495056/using-custom-ssl-client-certificates-system-net-httpclient-on-mono)

[1]: Similar bug #17768

Note You need to log in before you can comment on or make changes to this bug.