To handle SSL certificate validation correctly, change the code to call SslErrorHandler.proceed () when the certificate presented by the server meets your expectations and calls SslErrorHandler.cancel () otherwise.
As the email onReceivedSslError , onReceivedSslError should process the user, go to the page with the invalid certificate, for example, in the notification dialog box. You do not have to act directly.
For example, I am adding a warning dialog so that the user confirms and it looks like Google no longer displays the warning.
@Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { final AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.notification_error_ssl_cert_invalid); builder.setPositiveButton("continue", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.proceed(); } }); builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { handler.cancel(); } }); final AlertDialog dialog = builder.create(); dialog.show(); }
Explain in detail by e-mail.
In particular, the implementation ignores all SSL error certificate verification, making your application vulnerable to man-in-the-center attacks.
The email states that the default implementation ignored the important SSL security issue. Therefore, we need to process it in our own application that used WebView. Notify the user with an alert dialog box is an easy way.
sakiM Mar 22 '16 at 6:53 2016-03-22 06:53
source share