diff --git a/build.gradle b/build.gradle index f0fcfa63..4088cb5b 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ android { buildToolsVersion '27.0.3' compileSdkVersion 27 defaultConfig { - minSdkVersion 16 + minSdkVersion 14 targetSdkVersion 25 //multiDexEnabled true //testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner" diff --git a/src/org/kde/kdeconnect/Helpers/SecurityHelpers/SslHelper.java b/src/org/kde/kdeconnect/Helpers/SecurityHelpers/SslHelper.java index 5cee5465..25ce5c87 100644 --- a/src/org/kde/kdeconnect/Helpers/SecurityHelpers/SslHelper.java +++ b/src/org/kde/kdeconnect/Helpers/SecurityHelpers/SslHelper.java @@ -204,6 +204,26 @@ public class SslHelper { public static void configureSslSocket(SSLSocket socket, boolean isDeviceTrusted, boolean isClient) throws SocketException { + socket.setEnabledProtocols(new String[]{"TLSv1"}); //Newer TLS versions are only supported on API 16+ + + // These cipher suites are most common of them that are accepted by kde and android during handshake + ArrayList supportedCiphers = new ArrayList<>(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + supportedCiphers.add("TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"); // API 20+ + supportedCiphers.add("TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"); // API 20+ + supportedCiphers.add("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"); // API 11+ + } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + supportedCiphers.add("TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA"); // API 11+ + supportedCiphers.add("SSL_RSA_WITH_RC4_128_SHA"); // API 9+ + supportedCiphers.add("SSL_RSA_WITH_RC4_128_MD5"); // API 9+ + } else { + // Following ciphers are for and due to old devices + supportedCiphers.add("SSL_RSA_WITH_RC4_128_SHA"); // API 9+ + supportedCiphers.add("SSL_RSA_WITH_RC4_128_MD5"); // API 9+ + supportedCiphers.add("TLS_DHE_RSA_WITH_AES_256_CBC_SHA"); // API 9+ + } + socket.setEnabledCipherSuites(supportedCiphers.toArray(new String[supportedCiphers.size()])); + socket.setSoTimeout(1000); if (isClient) {