webview-with-client-certificate
webview-with-client-certificate copied to clipboard
ICS support
Hey, really nice project! However, for me it only works on pre-ICS devices, the certificate is not sent on ICS devices.
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/
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.
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 ?
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 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.