mirror of
https://invent.kde.org/network/kdeconnect-android.git
synced 2025-12-12 20:35:58 +01:00
Commit from pc
This commit is contained in:
@@ -12,6 +12,9 @@ apply plugin: 'com.android.application'
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion 22
|
compileSdkVersion 22
|
||||||
buildToolsVersion '22.0.1'
|
buildToolsVersion '22.0.1'
|
||||||
|
dexOptions {
|
||||||
|
javaMaxHeapSize "4g"
|
||||||
|
}
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 9
|
minSdkVersion 9
|
||||||
targetSdkVersion 22
|
targetSdkVersion 22
|
||||||
|
|||||||
@@ -12,7 +12,15 @@ conscrypt_jni.jar is shared library for JNI for OpenSSL Provider, packed into a
|
|||||||
|
|
||||||
To update these libraries, they can be diretly built from AOSP with build type as "user"
|
To update these libraries, they can be diretly built from AOSP with build type as "user"
|
||||||
|
|
||||||
conscrypt.jar = $OUT_DIR/target/common/obj/JAVA_LIBRARIES/conscrypt_unbundled_intermediates/javalib.jar
|
To build this library, follow these steps :
|
||||||
conscrypt_jni.jar = $OUT_DIR/target/product/generic/obj/lib/libconscrypt_jni.so
|
1. Download the AOSP source,proceed as mentioned on aosp site.
|
||||||
and put as lib/armeabi/libconscrypt_jni.so and compress lib directory as jar archive.
|
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.
|
||||||
|
|
||||||
|
|||||||
1
proguard-rules.pro
vendored
1
proguard-rules.pro
vendored
@@ -19,6 +19,7 @@
|
|||||||
# Allow obfuscation of android.support.v7.internal.view.menu.**
|
# Allow obfuscation of android.support.v7.internal.view.menu.**
|
||||||
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
|
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
|
||||||
# see https://code.google.com/p/android/issues/detail?id=78377
|
# see https://code.google.com/p/android/issues/detail?id=78377
|
||||||
|
-keepattributes Signature
|
||||||
-keep class !android.support.v7.internal.view.menu.**,** {*;}
|
-keep class !android.support.v7.internal.view.menu.**,** {*;}
|
||||||
|
|
||||||
-dontwarn org.apache.sshd.**
|
-dontwarn org.apache.sshd.**
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Log.i("KDE/LanLinkProvider", "Identity package received from " + np.getString("deviceName"));
|
Log.i("KDE/LanLinkProvider", "Identity package received from " + np.getString("deviceName"));
|
||||||
|
|
||||||
final LanLink link = new LanLink(context, ctx.channel(), np.getString("deviceId"), LanLinkProvider.this);
|
final LanLink link = new LanLink(context, ctx.channel(), np.getString("deviceId"), LanLinkProvider.this);
|
||||||
nioLinks.put(ctx.channel().hashCode(), link);
|
nioLinks.put(ctx.channel().hashCode(), link);
|
||||||
@@ -297,6 +297,7 @@ public class LanLinkProvider extends BaseLinkProvider {
|
|||||||
// Any exception or handshake exception ?
|
// Any exception or handshake exception ?
|
||||||
Log.e("KDE/LanLinkProvider", "Handshake failed with " + identityPackage.getString("deviceName"));
|
Log.e("KDE/LanLinkProvider", "Handshake failed with " + identityPackage.getString("deviceName"));
|
||||||
future.cause().printStackTrace();
|
future.cause().printStackTrace();
|
||||||
|
|
||||||
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
|
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onServiceStart(BackgroundService service) {
|
public void onServiceStart(BackgroundService service) {
|
||||||
|
|||||||
@@ -23,9 +23,12 @@ package org.kde.kdeconnect.Helpers.SecurityHelpers;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.provider.Settings;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
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.X500NameBuilder;
|
||||||
import org.spongycastle.asn1.x500.style.BCStyle;
|
import org.spongycastle.asn1.x500.style.BCStyle;
|
||||||
import org.spongycastle.cert.X509CertificateHolder;
|
import org.spongycastle.cert.X509CertificateHolder;
|
||||||
@@ -42,7 +45,6 @@ import java.security.MessageDigest;
|
|||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.security.Security;
|
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Formatter;
|
import java.util.Formatter;
|
||||||
@@ -50,6 +52,7 @@ import java.util.Formatter;
|
|||||||
import javax.net.ssl.KeyManagerFactory;
|
import javax.net.ssl.KeyManagerFactory;
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.SSLEngine;
|
import javax.net.ssl.SSLEngine;
|
||||||
|
import javax.net.ssl.SSLException;
|
||||||
import javax.net.ssl.TrustManager;
|
import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
@@ -81,7 +84,7 @@ public class SslHelper {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
X500NameBuilder nameBuilder = new X500NameBuilder(BCStyle.INSTANCE);
|
X500NameBuilder nameBuilder = new X500NameBuilder(BCStyle.INSTANCE);
|
||||||
nameBuilder.addRDN(BCStyle.CN, settings.getString("device_name_preference", "")); // TODO : Chamge it to deviceId
|
nameBuilder.addRDN(BCStyle.CN, Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID));
|
||||||
nameBuilder.addRDN(BCStyle.OU, "KDE Connect");
|
nameBuilder.addRDN(BCStyle.OU, "KDE Connect");
|
||||||
nameBuilder.addRDN(BCStyle.O, "KDE");
|
nameBuilder.addRDN(BCStyle.O, "KDE");
|
||||||
Date notBefore = new Date(System.currentTimeMillis());
|
Date notBefore = new Date(System.currentTimeMillis());
|
||||||
@@ -126,7 +129,7 @@ public class SslHelper {
|
|||||||
PrivateKey privateKey = RsaHelper.getPrivateKey(context);
|
PrivateKey privateKey = RsaHelper.getPrivateKey(context);
|
||||||
|
|
||||||
// Get remote device certificate if trusted
|
// Get remote device certificate if trusted
|
||||||
java.security.cert.Certificate remoteDeviceCertificate = null;
|
X509Certificate remoteDeviceCertificate = null;
|
||||||
if (isDeviceTrusted){
|
if (isDeviceTrusted){
|
||||||
SharedPreferences devicePreferences = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE);
|
SharedPreferences devicePreferences = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE);
|
||||||
byte[] certificateBytes = Base64.decode(devicePreferences.getString("certificate", ""), 0);
|
byte[] certificateBytes = Base64.decode(devicePreferences.getString("certificate", ""), 0);
|
||||||
@@ -205,6 +208,9 @@ public class SslHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for (String cipher : sslEngine.getEnabledCipherSuites()) {
|
||||||
|
// Log.e("Enabled cipher", cipher);
|
||||||
|
// }
|
||||||
return sslEngine;
|
return sslEngine;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user