Chrome For Android – How to intercept certificate selection

Issue

I’ve got a problem with an enterprise intranet (accessible only on the enterprise network).
This website needs a certificate installed on the tablet to be called. At launch, the website calls more than 10 URLs that are also secured.
The certificate is correctly installed on the tablet.

On Chrome for Windows, we’ve got no problem at all.
But when we try to access the website from a Chrome for Android, Chrome keeps asking which certificate to use (same problem described there)
So actually, when you connect to the website, you have more than 10 popup that ask you which certificate to use. When you restart the device, you have to do it again.

I found the http://www.chromium.org/administrators/policy-list-3#AutoSelectCertificateForUrls but it doesn’t seem to work on Android devices

I wanted to make an APK with Chrome Custom Tabs, I wanted to "pre-load" URLs calling and intercept for certificate asking, then I wished I would be able to give it the right one, but it doesn’t seem to be possible…

So I wondering how I could do, I’m new in Android coding, so I don’t know all the possibilities…

Any ideas?

Thanks!

Solution

The solution was to implement the WebView component, that allows you to intercept the certificate request from the server.
You’ll have to implement the WebViewClient class, and to use the onReceivedClientCertRequest :

@Override
public void onReceivedClientCertRequest(WebView view, final ClientCertRequest request) {
    Log.d(TAG, "Asking for certificate - url " + request.getHost() + " - " + request.getPort());
    request.proceed(mPrivateKey, mCertificates);
}

I wanted to retrieve the certificate from the android keystore, I shared the solution here.

Answered By – Ludo

Answer Checked By – Robin (FlutterFixes Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *