webview-with-client-certificate icon indicating copy to clipboard operation
webview-with-client-certificate copied to clipboard

ICS support

Open Grosskopferter opened this issue 12 years ago • 5 comments

Hey, really nice project! However, for me it only works on pre-ICS devices, the certificate is not sent on ICS devices.

Grosskopferter avatar May 15 '12 10:05 Grosskopferter

Sorry, I'm too late.

I tried to support ICS over the last six months. Yes, I found the method.

ICS added callback method onReceivedClientCertRequest for client certificate request.

public void onReceivedClientCertRequest( WebView view, ClientCertRequestHandler handler, String host_and_port )

By default this will cancle the request. http://stackoverflow.com/questions/10683643/webview-with-ssl-client-certificate-on-android-4-ics

I override it and proceed certificate request. Get certificates and privateKey from KeyStore. I can load web page with client certificate request!

However the method uses private Class. I need to create custom android.jar contains internal class. Because it uses override callback method with private class type.

You need to read following references https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-2-hacking-around/ https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-3-custom-android-platform/

You don't need this step. Eclipse is kept clean. https://devmaze.wordpress.com/2011/01/18/using-com-android-internal-part-4-customizing-adt/

yonekawa avatar Oct 27 '12 05:10 yonekawa

I committed ICS support code into ClientCertificateWebViewClient.java However it can't compile if you don't use custom android.jar. So, I commented out.

If you created custom android.jar, please uncomment it.

yonekawa avatar Oct 27 '12 05:10 yonekawa

Hi Yonekawa. I followed all the steps to create a custom Android.jar with internal classes. However i am not getting a callback for onReceivedClientCertRequest. Any suggestions ?

coolalok avatar Dec 20 '13 12:12 coolalok

I think because you are using the version that does not support this hidden method. I learned that this method did not supported from 4.2 version. Find: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.2_r1/android/webkit/WebViewClient.java/ @yonekawa : Is there another way to implement Client Cert with WebView? I also care about it.

lovecode2010 avatar Dec 24 '13 18:12 lovecode2010

@lovecode2010 Can we use WebView from 4.1.2 on devices with API >=4.2? I believe it should be possible to include WebView.java (+all dependencies), and refer to it as <org.custom.WebView> in layout.

surlac avatar Apr 10 '14 01:04 surlac