Advertencia SSL de google play

Tengo una advertencia de google play.

¿Cómo puedo manejar la "Vulnerabilidad del manejador de errores SSL" de la implementación insegura del controlador WebViewClient.onReceivedSslError.

"Para solucionar correctamente esta vulnerabilidad tan pronto como sea posible e incrementar el número de versión del APK actualizado Para manejar correctamente la validación de certificados SSL, cambie su código para invocar SslErrorHandler.proceed () siempre que el certificado presentado por el servidor cumpla con sus expectativas e invoque SslErrorHandler .cancel () de lo contrario. "

He recibido la misma advertencia de hoy, y me informa que el problema proviene del SDK de una de mis redes publicitarias (InMobi, realmente estoy pensando en dejarlas, ya que tienen un montón de fraudulentas, los banners de auto-redireccionamiento, y ahora esta…):

com.inmobi.commons.analytics.iat.impl.net.AdTrackerWebViewLoader$MyWebViewClient

¿Cuál es la clase afectada en su caso? Si es una de sus clases, tendrá que leer la documentación técnica y arreglar su implementación.

Si, como yo, eres víctima de una de tus bibliotecas externas, ponte en contacto con los desarrolladores para pedirles que proporcionen una biblioteca fija (o abandonar la biblioteca).

Primero debe comprobar que utiliza el controlador WebViewClient.onReceivedSslError correctamente.

Si no está utilizando la biblioteca WebViewClient o si ya lo está utilizando correctamente, probablemente el problema provenga de una biblioteca de terceros. Primero puede utilizar este comando linux en el directorio raíz de su proyecto para identificar qué bibliotecas podrían ser responsables del problema:

 find . -name '*.jar' -exec zipgrep -i onreceivedsslerror {} \; 

Esto mostrará los archivos dentro de todos los archivos jar que tengan la cadena "OnReceivedSslError".

Después de eso, puede comprobar si las recomendaciones de Google para manejar la vulnerabilidad se respetan en cada archivo coincidente.

Si no necesita manejar las cosas en onReceivedSslErr(WebView,SslErrorHandler,SslError) , simplemente elimine este método para evitar la onReceivedSslErr(WebView,SslErrorHandler,SslError) Google Play. De lo warning.Otherwise , tampoco debe proceder directamente. Aquí está un ejemplo de @sakiM, Webview evitar la alerta de seguridad de google play sobre la implementación de onReceivedSslError

 @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(); } 

Si el método onReceivedSslErr ha sido invocado por la 3ª biblioteca, solo póngase en contacto con el proveedor.

Hola aquí es la última solución para resolver su problema. Espero que ayude a alguien:

// COPY PASTE ESTE CÓDIGO Y QUITE EL método onReceivedError ().

  /** * Notify the host application that an SSL error occurred while loading a * resource. The host application must call either handler.cancel() or * handler.proceed(). Note that the decision may be retained for use in * response to future SSL errors. The default behavior is to cancel the * load. * * @param view The WebView that is initiating the callback. * @param handler An SslErrorHandler object that will handle the user's * response. * @param error The SSL error object. */ @Override public void onReceivedSslError(WebView view, final SslErrorHandler handler, SslError error) { //final AlertDialog.Builder builder = new AlertDialog.Builder(OnlinePayment.this); String msg=""; if(error.getPrimaryError()==SslError.SSL_DATE_INVALID || error.getPrimaryError()== SslError.SSL_EXPIRED || error.getPrimaryError()== SslError.SSL_IDMISMATCH || error.getPrimaryError()== SslError.SSL_INVALID || error.getPrimaryError()== SslError.SSL_NOTYETVALID || error.getPrimaryError()==SslError.SSL_UNTRUSTED) { if(error.getPrimaryError()==SslError.SSL_DATE_INVALID){ msg="The date of the certificate is invalid"; }else if(error.getPrimaryError()==SslError.SSL_INVALID){ msg="A generic error occurred"; } else if(error.getPrimaryError()== SslError.SSL_EXPIRED){ msg="The certificate has expired"; }else if(error.getPrimaryError()== SslError.SSL_IDMISMATCH){ msg="Hostname mismatch"; } else if(error.getPrimaryError()== SslError.SSL_NOTYETVALID){ msg="The certificate is not yet valid"; } else if(error.getPrimaryError()==SslError.SSL_UNTRUSTED){ msg="The certificate authority is not trusted"; } } final AlertDialog.Builder builder = new AlertDialog.Builder(OnlinePayment.this); builder.setMessage(msg); 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(); } 

Esto puede deberse a las bibliotecas de terceros utilizadas en su aplicación, que incluyen ssl abierto. Sucedió en mi caso. La biblioteca se menciona en la alerta de Google play. Utilicé el siguiente comando grep con esa biblioteca incluida

 $ unzip -p YourApp.apk | strings | grep "OpenSSL" 

Este comando mostrará un registro largo, si hay un problema de ssl abierto, debido a esa biblioteca.

 +com.android.org.conscrypt.OpenSSLSocketImpl 7org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl OpenSSLDie DH_OpenSSL OpenSSL_add_all_ciphers OpenSSL_add_all_digests DSA_OpenSSL ECDSA_OpenSSL ECDH_OpenSSL UI_OpenSSL OpenSSL/%lx.%lx.%lx%s OpenSSL 1.0.1h 5 Jun 2014 %s(%d): OpenSSL internal error, assertion failed: %s OpenSSL DH Method OpenSSL CMAC method OpenSSL HMAC method OpenSSL EC algorithm OpenSSL RSA method OpenSSL DSA method OpenSSL ECDSA method OpenSSL PKCS#3 DH method OpenSSL ECDH method You need to read the OpenSSL FAQ, http://www.openssl.org/support/faq.html OpenSSL default OpenSSL default user interface OpenSSL 'dlfcn' shared library method SSLv2 part of OpenSSL 1.0.1h 5 Jun 2014 SSLv3 part of OpenSSL 1.0.1h 5 Jun 2014 TLSv1 part of OpenSSL 1.0.1h 5 Jun 2014 DTLSv1 part of OpenSSL 1.0.1h 5 Jun 2014 MD4 part of OpenSSL 1.0.1h 5 Jun 2014 MD5 part of OpenSSL 1.0.1h 5 Jun 2014 SHA1 part of OpenSSL 1.0.1h 5 Jun 2014 SHA-256 part of OpenSSL 1.0.1h 5 Jun 2014 SHA-512 part of OpenSSL 1.0.1h 5 Jun 2014 DES part of OpenSSL 1.0.1h 5 Jun 2014 libdes part of OpenSSL 1.0.1h 5 Jun 2014 AES part of OpenSSL 1.0.1h 5 Jun 2014 Big Number part of OpenSSL 1.0.1h 5 Jun 2014 ^RSA part of OpenSSL 1.0.1h 5 Jun 2014 Diffie-Hellman part of OpenSSL 1.0.1h 5 Jun 2014 Stack part of OpenSSL 1.0.1h 5 Jun 2014 lhash part of OpenSSL 1.0.1h 5 Jun 2014 EVP part of OpenSSL 1.0.1h 5 Jun 2014 ASN.1 part of OpenSSL 1.0.1h 5 Jun 2014 PEM part of OpenSSL 1.0.1h 5 Jun 2014 X.509 part of OpenSSL 1.0.1h 5 Jun 2014 RC2 part of OpenSSL 1.0.1h 5 Jun 2014 IDEA part of OpenSSL 1.0.1h 5 Jun 2014 CAMELLIA part of OpenSSL 1.0.1h 5 Jun 2014 EDSA part of OpenSSL 1.0.1h 5 Jun 2014 ECDSA part of OpenSSL 1.0.1h 5 Jun 2014 ECDH part of OpenSSL 1.0.1h 5 Jun 2014 RAND part of OpenSSL 1.0.1h 5 Jun 2014 CONF part of OpenSSL 1.0.1h 5 Jun 2014 CONF_def part of OpenSSL 1.0.1h 5 Jun 2014 TXT_DB part of OpenSSL 1.0.1h 5 Jun 2014 SHA part of OpenSSL 1.0.1h 5 Jun 2014 RIPE-MD160 part of OpenSSL 1.0.1h 5 Jun 2014 RC4 part of OpenSSL 1.0.1h 5 Jun 2014 :Blowfish part of OpenSSL 1.0.1h 5 Jun 2014 \CAST part of OpenSSL 1.0.1h 5 Jun 2014 OpenSSLDie DH_OpenSSL OpenSSL_add_all_ciphers OpenSSL_add_all_digests DSA_OpenSSL ECDSA_OpenSSL ECDH_OpenSSL UI_OpenSSL %s(%d): OpenSSL internal error, assertion failed: %s You need to read the OpenSSL FAQ, http://www.openssl.org/support/faq.html OpenSSL default user interface OpenSSL 'dlfcn' shared library method OpenSSL/%lx.%lx.%lx%s OpenSSL 1.0.1h 5 Jun 2014 OpenSSL DH Method OpenSSL CMAC method OpenSSL HMAC method OpenSSL EC algorithm OpenSSL RSA method OpenSSL DSA method OpenSSL ECDSA method OpenSSL PKCS#3 DH method OpenSSL ECDH method OpenSSL default SSLv2 part of OpenSSL 1.0.1h 5 Jun 2014 SSLv3 part of OpenSSL 1.0.1h 5 Jun 2014 TLSv1 part of OpenSSL 1.0.1h 5 Jun 2014 DTLSv1 part of OpenSSL 1.0.1h 5 Jun 2014 MD4 part of OpenSSL 1.0.1h 5 Jun 2014 MD5 part of OpenSSL 1.0.1h 5 Jun 2014 SHA1 part of OpenSSL 1.0.1h 5 Jun 2014 SHA-256 part of OpenSSL 1.0.1h 5 Jun 2014 SHA-512 part of OpenSSL 1.0.1h 5 Jun 2014 DES part of OpenSSL 1.0.1h 5 Jun 2014 libdes part of OpenSSL 1.0.1h 5 Jun 2014 AES part of OpenSSL 1.0.1h 5 Jun 2014 Big Number part of OpenSSL 1.0.1h 5 Jun 2014 ^RSA part of OpenSSL 1.0.1h 5 Jun 2014 Diffie-Hellman part of OpenSSL 1.0.1h 5 Jun 2014 Stack part of OpenSSL 1.0.1h 5 Jun 2014 lhash part of OpenSSL 1.0.1h 5 Jun 2014 EVP part of OpenSSL 1.0.1h 5 Jun 2014 ASN.1 part of OpenSSL 1.0.1h 5 Jun 2014 PEM part of OpenSSL 1.0.1h 5 Jun 2014 X.509 part of OpenSSL 1.0.1h 5 Jun 2014 RC2 part of OpenSSL 1.0.1h 5 Jun 2014 IDEA part of OpenSSL 1.0.1h 5 Jun 2014 DSA part of OpenSSL 1.0.1h 5 Jun 2014 ECDSA part of OpenSSL 1.0.1h 5 Jun 2014 ECDH part of OpenSSL 1.0.1h 5 Jun 2014 RAND part of OpenSSL 1.0.1h 5 Jun 2014 CONF part of OpenSSL 1.0.1h 5 Jun 2014 CONF_def part of OpenSSL 1.0.1h 5 Jun 2014 TXT_DB part of OpenSSL 1.0.1h 5 Jun 2014 SHA part of OpenSSL 1.0.1h 5 Jun 2014 RIPE-MD160 part of OpenSSL 1.0.1h 5 Jun 2014 Blowfish part of OpenSSL 1.0.1h 5 Jun 2014 \CAST part of OpenSSL 1.0.1h 5 Jun 2014 

Intente el mismo comando, para otro apk, sin esa biblioteca. Se mostrará sólo dos líneas como el siguiente

 +com.android.org.conscrypt.OpenSSLSocketImpl 7org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl 
  • Renderizar archivos epub en android
  • Eliminar archivos almacenados en caché - WebView Android 4.4+
  • ¿Hay una mejor vista web para Android
  • ¿Cuál es el archivo html más grande que se puede cargar en un WebView de Android?
  • Webview - cambiar la fuente de la página antes de mostrar el sitio web?
  • Recuerda la contraseña emergente en el problema de la vista web de Android
  • Webview no admite la caja flexible en Android Jellybean
  • Política de seguridad de contenido de WebView
  • Inserte instagram en Android WebView
  • Cómo forzar el teclado con números en el sitio web para móviles en Android
  • Android WebView: deshabilitar el degradado del borde amarillo de desplazamiento
  • FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.