I would like to override the onReceivedSslError()
of a WebViewClient
. Here I want to check if the error.getCertificate()
certificate is signed from a self-signed CA and, only in this case, call the handler.proceed()
. In pseudo-code:
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
SslCertificate serverCertificate = error.getCertificate();
if (/* signed from my self-signed CA */) {
handler.proceed();
}
else {
super.onReceivedSslError(view, handler, error);
}
}
The public key of my CA is saved in a BouncyCastle resource called rootca.bks
. How can I do?