¿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)

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?

  1. ¿Es correcto que Volley vuelva a SSLV3?

  2. ¿Por qué volley fallback a SSLV3? En otras palabras, ¿cuál fue el fallo original que causó el fallback y cómo resolverlo?

  3. I Descargé Volley recientemente, pero no estoy seguro de que sea el último. ¿Cómo puedo encontrar la versión que tengo ?.

¿Alguna idea?

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:

http://square.github.io/retrofit/

FlipAndroid es un fan de Google para Android, Todo sobre Android Phones, Android Wear, Android Dev y Aplicaciones para Android Aplicaciones.