¿Por qué vuelve Volley a SSLV3?
Estoy constantemente monitoreando mis errores de aplicación y veo el siguiente error demasiadas veces
javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb8f0fc28: Failure in SSL library, usually a protocol error
Error: 14077410: rutinas SSL: SSL23_GET_SERVER_HELLO: fallo de handshake de alerta sslv3 (external / openssl / ssl / s23_clnt.c: 741 0xaa48cd5c: 0x00000000) -javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: Protocolo SSL abortado: Ssl = 0xb8f0fc28: Error en la biblioteca SSL, generalmente un error de error de protocolo: 14077410: Rutinas SSL: SSL23_GET_SERVER_HELLO: fallo de handshake de alerta sslv3 (external / openssl / ssl / s23_clnt.c: 741 0xaa48cd5c: 0x00000000)
- Javax.net.ssl.SSLHandshakeException: Conexión cerrada por peer en com.android.org.conscrypt.NativeCrypto.SSL_do_handshake (Native Method)
- Certificado auto-firmado de Android: Ancla de confianza para la ruta de certificación no encontrada
- Universal-Image-Loader | SSLHandshakeException: El apretón de manos falló
- "Certificado de servidor no confiable" en Android 2.2 pero no 3.0
- Javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake abortado: Fallo en la biblioteca SSL, generalmente un error de protocolo
Usted puede ver que el error está sobre SSLV3 y mi servidor apoya solamente TLSV1.2.
Parece que en algunos clientes Volley vuelve a usar SSLV3 (por alguna razón) y reciben un error.
Los usuarios que reciben este error están en Android 4.4.2, 4.4.4 y 4.1.1 y más.
Curiosamente, también uso DefaultHttpClient en la misma aplicación, pero no parece informar el mismo problema.
Estoy usando el HurlStack por defecto en Volley
He visto lo siguiente … Deshabilitar SSL como un protocolo en HttpsURLConnection
Y https://code.google.com/p/android/issues/detail?id=78187
Entonces ¿cuales son mis opciones?
-
¿Es correcto que Volley vuelva a SSLV3?
-
¿Por qué volley fallback a SSLV3? En otras palabras, ¿cuál fue el fallo original que causó el fallback y cómo resolverlo?
-
I Descargé Volley recientemente, pero no estoy seguro de que sea el último. ¿Cómo puedo encontrar la versión que tengo ?.
¿Alguna idea?
- Usando Volley en Android 2.3.3 y obteniendo SSLHandshakeException
- Error del apretón de manos del emulador http-proxy SSL de Android
- SSLHandshakeException: Handshake falló en Android N / 7.0
- Error "Conexión cerrada por peer" en Android 7.0 Nougat mientras se conecta a SHA256 CA instalado Windows 2003 Server SP2 a través de HTTPS
Su servidor hace bien que no soporta SSLv3 ya que tiene algunos problemas de seguridad y no debe utilizarse.
Cuando utilice versiones de Android antes de Kitkat debe utilizar una fábrica de socket que elimine SSLv3 para ser utilizado como configuración predeterminada:
public class VolleyToolboxExtension extends Volley { /** Default on-disk cache directory. */ private static final String DEFAULT_CACHE_DIR = "volley"; /** * Creates a default instance of the worker pool and calls {@link RequestQueue#start()} on it. * * @param context A {@link Context} to use for creating the cache dir. * @param stack An {@link HttpStack} to use for the network, or null for default. * @return A started {@link RequestQueue} instance. */ public static RequestQueue newRequestQueue(Context context, HttpStack stack) { File cacheDir = new File(context.getCacheDir(), DEFAULT_CACHE_DIR); String userAgent = "volley/0"; try { String packageName = context.getPackageName(); PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0); userAgent = packageName + "/" + info.versionCode; } catch (PackageManager.NameNotFoundException e) { } if (stack == null) { if (Build.VERSION.SDK_INT >= 9) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { // Use a socket factory that removes sslv3 stack = new HurlStack(null, new NoSSLv3Compat.NoSSLv3Factory()); } else { stack = new HurlStack(); } } else { // Prior to Gingerbread, HttpUrlConnection was unreliable. // See: http://android-developers.blogspot.com/2011/09/androids-http-clients.html stack = new HttpClientStack(AndroidHttpClient.newInstance(userAgent)); } } Network network = new BasicNetwork(stack); RequestQueue queue = new RequestQueue(new DiskBasedCache(cacheDir), network); queue.start(); return queue; } /** * Creates a default instance of the worker pool and calls {@link RequestQueue#start()} on it. * * @param context A {@link Context} to use for creating the cache dir. * @return A started {@link RequestQueue} instance. */ public static RequestQueue newRequestQueue(Context context) { return newRequestQueue(context, null); } }
NoSSLv3Compat clase se puede encontrar aquí: https://github.com/Floens/volley/blob/master/src/com/android/volley/compat/NoSSLv3Compat.java
Utilice esta extensión para crear su cola de solicitudes:
/** * @return The Volley Request queue, the queue will be created if it is null */ public RequestQueue getRequestQueue() { // lazy initialize the request queue, the queue instance will be // created when it is accessed for the first time if (mRequestQueue == null) { // Create the request queue mRequestQueue = VolleyToolboxExtension.newRequestQueue(getApplicationContext()); } return mRequestQueue; }
También podría usar Retrofit en lugar de Volley, ya que Square lanzó la versión 2.1 de esta biblioteca que soporta la configuración de la versión TLS: