2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Revert "Remove legacy ciphers now that we don't support API<16"

This reverts commit f330053015.
This commit is contained in:
Albert Vaca
2018-05-20 23:35:07 +02:00
parent ebf63dd294
commit b282d3a7d0
2 changed files with 21 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ android {
buildToolsVersion '27.0.3' buildToolsVersion '27.0.3'
compileSdkVersion 27 compileSdkVersion 27
defaultConfig { defaultConfig {
minSdkVersion 16 minSdkVersion 14
targetSdkVersion 25 targetSdkVersion 25
//multiDexEnabled true //multiDexEnabled true
//testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner" //testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"

View File

@@ -204,6 +204,26 @@ public class SslHelper {
public static void configureSslSocket(SSLSocket socket, boolean isDeviceTrusted, boolean isClient) throws SocketException { 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<String> 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); socket.setSoTimeout(1000);
if (isClient) { if (isClient) {