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

ClientCertificate AllowedCertificateAuthorities returns binary data instead of string list #2346

Closed
wilva opened this issue Apr 7, 2022 · 4 comments
Assignees
Labels
bug Something isn't working tracked We are tracking this work internally.

Comments

@wilva
Copy link

wilva commented Apr 7, 2022

Description
Using WebView2Samples, WinForms example I reproduced this.
Add the following code to the example project:

       private void WebView2Control_ClientCertificateRequested(object sender, CoreWebView2ClientCertificateRequestedEventArgs e)
        {
            IReadOnlyList<string> CAList = e.AllowedCertificateAuthorities;
            if (CAList.Count() > 0)
            {

            }
        }

and
this.webView2Control.CoreWebView2.ClientCertificateRequested += WebView2Control_ClientCertificateRequested;
Compile the example
Put a breakpoint on the line:
if (CAList.Count() > 0)
visit the site: https://client.badssl.com
When you hover over the breakpoint, you'll see that the data in CAList is:
"[0] = "0~1\v0\t\u0006\u0003U\u0004\u0006\u0013\u0002US1\u00130\u0011\u0006\u0003U\u0004\b\f\nCalifornia1\u00160\u0014\u0006\u0003U\u0004\a\f\rSan Francisco1\u000f0\r\u0006\u0003U\u0004\n\f\u0006BadSSL110/\u0006\u0003U\u0004\u0003\f(BadSSL Client Root Certificate ..."

I had expected something more readable, this does not seem right to me.
FWIW, I also see this on Win32, but that needs a lot more code to show what goes wrong.

Version
Runtime: 100.0.1185.29
Framework: WinForms
OS: Win10

AB#39005860

@wilva wilva added the bug Something isn't working label Apr 7, 2022
@champnic
Copy link
Member

Hey @wilva - I believe this may be By Design. @monica-ch do you know more about this? Thanks!

@champnic champnic self-assigned this Apr 12, 2022
@wilva
Copy link
Author

wilva commented Apr 12, 2022

Hi @champnic,

Thanks, I did wondered if it is intentional (DER encoding?), but the documentation here says it is a string:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.web.webview2.core.corewebview2clientcertificaterequestedeventargs.allowedcertificateauthorities?view=webview2-dotnet-1.0.1150.38#microsoft-web-webview2-core-corewebview2clientcertificaterequestedeventargs-allowedcertificateauthorities

AFAICT it isn't best practice to use a string data type for binary data. It is at least unexpected and if it was by design, then you might want to update the doc with how it is encoded.

@champnic
Copy link
Member

I agree we should make our docs more clear here, whatever the expected format it.

@champnic
Copy link
Member

This is fixed in runtimes version 108.0.1432.0+. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracked We are tracking this work internally.
Projects
None yet
Development

No branches or pull requests

2 participants