背景
SSLv3协议是不安全的,在我阅读一些文章之后,我使用这个解决方案来删除该协议。
该方法删除sslv3:
@Override
public void setEnabledProtocols(String[] protocols) {
if (protocols != null && protocols.length == 1 && "SSLv3".equals(protocols[0])) {
// no way jose
// see issue https://code.google.com/p/android/issues/detail?id=78187
List<String> enabledProtocols = new ArrayList<String>(Arrays.asList(delegate.getEnabledProtocols()));
for (String pro : enabledProtocols) {
VolleyLog.d(pro);
}
if (enabledProtocols.size() > 1) {
enabledProtocols.remove("SSLv3");
VolleyLog.d("Removed SSLv3 from enabled protocols");
} else {
VolleyLog.d("SSL stuck with protocol available for " + String.valueOf(enabledProtocols));
}
protocols = enabledProtocols.toArray(new String[enabledProtocols.size()]);
}
super.setEnabledProtocols(protocols);
}我使用Volley作为http客户端,下面是初始化请求队列的代码:
HttpStack stack;
if (Build.VERSION.SDK_INT >= 9) {
// Use a socket factory that removes sslv3
// https://code.google.com/p/android/issues/detail?id=78187
stack = new HurlStack(null, new NoSSLv3Compat.NoSSLv3Factory());
} 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));
}设备与环境
我正在使用小米M3与MIUI,这是基于Android4.4.4。
当调用setEnabledProtocols方法时,我打印一些日志:
D/Volley: [1444] NoSSLv3SSLSocket.setEnabledProtocols: SSLv3
D/Volley: [1444] NoSSLv3SSLSocket.setEnabledProtocols: TLSv1
D/Volley: [1444] NoSSLv3SSLSocket.setEnabledProtocols: Removed SSLv3 from enabled protocols问题
当我试图加载这个失败的图像时,输出:
NoConnectionError: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL握手终止: ssl=0x77f49768: SSL库中的失败,通常是协议错误 错误:1409443E:ssl routines:SSL3_READ_BYTES:tlsv1警报不适当的回退(外部/openssl/ssl/s3_pkt.c:1256 0x77f4c280:0x00000003)
此映像服务器支持以下协议:
TLS 1.2、TLS 1.1、TLS 1.0、SSL 3
你能帮我弄清楚吗?
发布于 2016-03-16 18:42:20
你查过钥匙的大小了吗。启用调试日志以查看确切的问题。可能是由于要连接的后端键大小不足造成的。
为java 7启用JCE无限
识别握手错误
https://stackoverflow.com/questions/35840179
复制相似问题