Request with automatic or user selection of appropriate client certificate

Viewed 3121

I'm developing an hybrid cordova app which might connect to different servers. Some of them do require a client certificate.

On an Android mobile the corresponding root cert + client certificate is installed.

On Chrome browser I get the following dialog to choose the corresponding client certificate for the Web connection.

Choose certificate on Chrome

With the cordova plugin cordova-client-cert-authentication the same dialog pops up for Http(s) requests within the WebView.

My question is how to achieve a automatic certificate selection on Http(s) requests on the native Android platform without explicitly declaring the corresponding client certificate. Or is there something similiar to the user selection of certificate like implemented on Chrome?

This is the current implementation, which throws a handshake exception:

try {
    URL url = new URL( versionUrl );
    HttpsURLConnection urlConnection = ( HttpsURLConnection ) url.openConnection();

    urlConnection.setConnectTimeout( 10000 );

    InputStream in = urlConnection.getInputStream();
}
catch(Exception e)
{
    //javax.net.ssl.SSLHandshakeException: Handshake failed
}
2 Answers
Related