Skip to content
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

AndroidMessageHandler doesn't use ClientCertificates #7274

Closed
simonrozsival opened this issue Aug 17, 2022 · 0 comments · Fixed by #8961
Closed

AndroidMessageHandler doesn't use ClientCertificates #7274

simonrozsival opened this issue Aug 17, 2022 · 0 comments · Fixed by #8961
Assignees
Labels
Area: HTTP Issues with sockets / HttpClient.

Comments

@simonrozsival
Copy link
Member

Android application type

Classic Xamarin.Android (MonoAndroid12.0, etc.), Android for .NET (net6.0-android, etc.)

Affected platform version

.NET 6.0

Description

A customer reported they can't use the ClientCertificates property of AndroidMessageHandler in their app (dotnet/runtime#73960). The ClientCertificates property is defined to match the API of System.Net.Http.HttpClientHandler, but it's never used.

Steps to Reproduce

The following code doesn't work:

var handler = new HttpClientHandler(); // assuming $(UseNativeHttpHandler)=true
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
// ClientCertificates is `null` even though the HttpClientHandler's property isn't annotated as nullable
handler.ClientCertificates.Add(certificate);

var client = new HttpClient(handler);
// if the server requires client certificate, this request will fail because the certificate we added was ignored
var result = await client.GetAsync("...");

Did you find any workaround?

Customers can extend AndroidMessageHandler and implement the functionality by overriding the ConfigureKeyStore method.

Relevant log output

No response

@simonrozsival simonrozsival added Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). needs-triage Issues that need to be assigned. labels Aug 17, 2022
@jpobst jpobst assigned simonrozsival and unassigned jpobst Aug 18, 2022
@jpobst jpobst removed the needs-triage Issues that need to be assigned. label Aug 18, 2022
@jpobst jpobst added Area: HTTP Issues with sockets / HttpClient. and removed Area: Mono.Android Issues with the Android API binding (Mono.Android.dll). labels Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: HTTP Issues with sockets / HttpClient.
Projects
None yet
2 participants