2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-29 13:17:43 +00:00

Removed conscrypt

Fixed issue in netty, currently use custom build netty
Removed multi dex
This commit is contained in:
Vineet Garg 2015-08-17 22:56:18 +05:30
parent 7c9d6630d0
commit 50fcea2cd9
10 changed files with 8 additions and 49 deletions

View File

@ -33,7 +33,6 @@
android:icon="@drawable/icon"
android:label="KDE Connect"
android:theme="@style/KdeConnectTheme"
android:name="android.support.multidex.MultiDexApplication"
>
<service

View File

@ -18,7 +18,6 @@ android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
multiDexEnabled true
}
sourceSets {
main {
@ -53,17 +52,16 @@ dependencies {
repositories {
mavenCentral()
}
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.madgag.spongycastle:pkix:1.52.0.0'
compile 'org.apache.sshd:sshd-core:0.8.0'
compile 'org.bouncycastle:bcprov-jdk16:1.46'
compile 'io.netty:netty-all:4.0.29.Final'
compile fileTree(dir: 'libs', include: '*.jar')
// compile 'io.netty:netty-all:4.0.29.Final' // We use a custom build netty in libs directory due to ssl related bug
// compile fileTree(include: '*.jar', dir: 'libs')
androidTestCompile 'org.mockito:mockito-core:1.10.19'
// Because mockito has some problems with dex environment
androidTestCompile 'com.google.dexmaker:dexmaker:1.1'
androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.1'
compile files('libs/netty-handler.jar')
}

Binary file not shown.

View File

@ -1,26 +0,0 @@
Conscrypt
https://conscrypt.org/
Conscrypt is a Java Security Provider that uses OpenSSL. Since Android uses it internally too, but that is not updated. These libraries are built directly form AOSP source on 28-Jun-2015.
The source for conscrypt is availble at https://android.googlesource.com/platform/external/conscrypt
The structure of two jar files used here is as follows :
conscrypt.jar is the Java library for OpenSSL Provider.
conscrypt_jni.jar is shared library for JNI for OpenSSL Provider, packed into a jar.
To update these libraries, they can be diretly built from AOSP with build type as "user"
To build this library, follow these steps :
1. Download the AOSP source,proceed as mentioned on aosp site.
2. Run ". build/envsetup.sh", from source root
3. Run "lunch aosp_<architecture>-user", the architecture can be arm, x86, mips
4. Run "cd external/conscrypt"
5. Run "mma -j8"
6. conscrypt.jar can be found at $OUT_DIR/target/common/obj/JAVA_LIBRARIES/ conscrypt_unbundled_intermediates/javalib.jar
7. For arm, libconscrypt_jni.so will be at $OUT_DIR/target/product/generic/obj/lib/libconscrypt_jni.so
For x86, libconscrypt_jni.so will be at $OUT_DIR/target/product/generic_x86/obj/lib/libconscrypt_jni.so
For mips, libconscrypt_jni.so will be at $OUT_DIR/target/product/generic_mips/obj/lib/libconscrypt_jni.so
Put these libraries under lib/<architecture>/libconscrypt_jni.so, and compress lib directory as jar archive.

Binary file not shown.

BIN
libs/netty-all.jar Normal file

Binary file not shown.

1
proguard-rules.pro vendored
View File

@ -27,7 +27,6 @@
-dontwarn org.bouncycastle.**
-dontwarn org.slf4j.**
-dontwarn io.netty.**
-dontwarn org.conscrypt.**
-dontwarn org.spongycastle.**
-keepattributes SourceFile,LineNumberTable

View File

@ -30,7 +30,6 @@ import android.os.IBinder;
import android.preference.PreferenceManager;
import android.util.Log;
import org.conscrypt.OpenSSLProvider;
import org.kde.kdeconnect.Backends.BaseLink;
import org.kde.kdeconnect.Backends.BaseLinkProvider;
import org.kde.kdeconnect.Backends.LanBackend.LanLinkProvider;
@ -38,7 +37,6 @@ import org.kde.kdeconnect.Helpers.SecurityHelpers.RsaHelper;
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper;
import org.kde.kdeconnect.UserInterface.MainSettingsActivity;
import java.security.Security;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
@ -200,12 +198,6 @@ public class BackgroundService extends Service {
public void onCreate() {
super.onCreate();
try {
Security.insertProviderAt(new OpenSSLProvider("KDEConnect SSL Provider"), 1);
} catch (Exception e) {
Log.e("KDE/BackgroundService", "Cannot add security provider");
}
// Register screen on listener
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
registerReceiver(new KdeConnectBroadcastReceiver(), filter);

View File

@ -230,9 +230,9 @@ public class DeviceHelper {
humanReadableNames.put("MOTWX435KT","Motorola Triumph");
humanReadableNames.put("N3","Star NO.1 N3");
humanReadableNames.put("N860","ZTE Warp N860");
humanReadableNames.put("NEXUS\ 4","Nexus 4");
humanReadableNames.put("NEXUS\ 5","Nexus 5");
humanReadableNames.put("NEXUS\ 6","Nexus 6");
humanReadableNames.put("NEXUS_4","Nexus 4");
humanReadableNames.put("NEXUS_5","Nexus 5");
humanReadableNames.put("NEXUS_6","Nexus 6");
humanReadableNames.put("Nexus_10","Google Nexus 10");
humanReadableNames.put("Nexus_4","Google Nexus 4");
humanReadableNames.put("Nexus_7","Asus Nexus 7");

View File

@ -27,8 +27,6 @@ import android.provider.Settings;
import android.util.Base64;
import android.util.Log;
import org.kde.kdeconnect.UserInterface.MainActivity;
import org.kde.kdeconnect.UserInterface.MainSettingsActivity;
import org.spongycastle.asn1.x500.X500NameBuilder;
import org.spongycastle.asn1.x500.style.BCStyle;
import org.spongycastle.cert.X509CertificateHolder;
@ -53,7 +51,6 @@ import java.util.Formatter;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.SSLException;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
@ -147,7 +144,7 @@ public class SslHelper {
keyStore.setKeyEntry("key", privateKey, "".toCharArray(), new java.security.cert.Certificate[]{certificate});
// Set certificate if device trusted
if (remoteDeviceCertificate != null){
keyStore.setCertificateEntry("remoteCertificate", remoteDeviceCertificate);
keyStore.setCertificateEntry(deviceId, remoteDeviceCertificate);
}
// Setup key manager factory
@ -176,7 +173,7 @@ public class SslHelper {
}
};
SSLContext tlsContext = SSLContext.getInstance("TLSv1.2");
SSLContext tlsContext = SSLContext.getInstance("TLS");
if (isDeviceTrusted) {
tlsContext.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom());
}else {