我做了一个应用程序,它使用WebView
和YouTube iframe
观看YouTube视频。我使用WebViewClient
来存储所有网址,我想强制使用我生成的私钥,这样我就可以解密Wireshark流量(我使用Android命令行和tcpdump
命令在应用中捕获流量)。onReceivedClientCertRequest不叫
我WebViewClient
类是这样的:
private class MyWebviewClient extends WebViewClient {
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
// TODO Auto-generated method stub
super.onReceivedError(view, errorCode, description, failingUrl);
Log.d(TAG, "onReceivedError : description = " + description);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
System.out.println("********************************************");
Log.d(TAG, "shouldOverrideUrlLoading : url = " + url);
return true;
}
@Override
public void onLoadResource(WebView view, String url) {
webAppInterface.logResourceURL(url);
System.out.println("************************************ " + url + " ************************************");
}
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
handler.proceed();
}
//forcing my private key
@Override
public void onReceivedClientCertRequest(WebView view, ClientCertRequest request) {
System.out.println("test test test");
X509Certificate cert = CertificateKey.getCertificate();
X509Certificate[] mCertificates = new X509Certificate[1];
mCertificates[0] = (X509Certificate)cert;
request.proceed(CertificateKey.getKey(), mCertificates);
}
}
的问题是方法onReceivedClientCertRequest
不会被调用!我甚至没有打印。
- 其他所有方法工作打算(即
onLoadResource
作品) - 我使用
SSL/HTTPS
如可以在Wireshark的捕获的流量 wireshark traffic - 我使用的方法
onReceivedSslError(view, handler, error)
在错误 - 我的情况可以看出我使用自己生成的证书(这是不是由CA签署,至少我认为)
- 证书和私钥都保存在手机上
问题是Android版本(目前为5.1)吗?