From 539ea8f71ac16e087e8abfc034ed743f400d19bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20Kn=C3=B6ller?= Date: Thu, 30 Oct 2014 17:55:22 +0100 Subject: [PATCH] TLSv1.1 and TLSv1.2 fix --- .../android/lib/common/network/AdvancedSslSocketFactory.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/owncloud/android/lib/common/network/AdvancedSslSocketFactory.java b/src/com/owncloud/android/lib/common/network/AdvancedSslSocketFactory.java index 7b41282b..27c6693e 100644 --- a/src/com/owncloud/android/lib/common/network/AdvancedSslSocketFactory.java +++ b/src/com/owncloud/android/lib/common/network/AdvancedSslSocketFactory.java @@ -86,6 +86,7 @@ public class AdvancedSslSocketFactory implements ProtocolSocketFactory { */ public Socket createSocket(String host, int port, InetAddress clientHost, int clientPort) throws IOException, UnknownHostException { Socket socket = mSslContext.getSocketFactory().createSocket(host, port, clientHost, clientPort); + ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1", "TLSv1.1", "TLSv1.2"}); verifyPeerIdentity(host, port, socket); return socket; } @@ -161,6 +162,7 @@ public class AdvancedSslSocketFactory implements ProtocolSocketFactory { SocketFactory socketfactory = mSslContext.getSocketFactory(); Log_OC.d(TAG, " ... with connection timeout " + timeout + " and socket timeout " + params.getSoTimeout()); Socket socket = socketfactory.createSocket(); + ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1", "TLSv1.1", "TLSv1.2"}); SocketAddress localaddr = new InetSocketAddress(localAddress, localPort); SocketAddress remoteaddr = new InetSocketAddress(host, port); socket.setSoTimeout(params.getSoTimeout()); @@ -178,6 +180,7 @@ public class AdvancedSslSocketFactory implements ProtocolSocketFactory { UnknownHostException { Log_OC.d(TAG, "Creating SSL Socket with remote " + host + ":" + port); Socket socket = mSslContext.getSocketFactory().createSocket(host, port); + ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1", "TLSv1.1", "TLSv1.2"}); verifyPeerIdentity(host, port, socket); return socket; }