Commit from pc

This commit is contained in:
Vineet Garg
2015-07-18 18:57:09 +05:30
parent fd5063e7a7
commit d1dc0ba2b2
5 changed files with 26 additions and 7 deletions

View File

@@ -12,6 +12,9 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
minSdkVersion 9
targetSdkVersion 22

View File

@@ -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"
conscrypt.jar = $OUT_DIR/target/common/obj/JAVA_LIBRARIES/conscrypt_unbundled_intermediates/javalib.jar
conscrypt_jni.jar = $OUT_DIR/target/product/generic/obj/lib/libconscrypt_jni.so
and put as lib/armeabi/libconscrypt_jni.so and compress lib directory as jar archive.
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.

1
proguard-rules.pro vendored
View File

@@ -19,6 +19,7 @@
# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
-keepattributes Signature
-keep class !android.support.v7.internal.view.menu.**,** {*;}
-dontwarn org.apache.sshd.**

View File

@@ -159,7 +159,7 @@ public class LanLinkProvider extends BaseLinkProvider {
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);
nioLinks.put(ctx.channel().hashCode(), link);
@@ -297,6 +297,7 @@ public class LanLinkProvider extends BaseLinkProvider {
// Any exception or handshake exception ?
Log.e("KDE/LanLinkProvider", "Handshake failed with " + identityPackage.getString("deviceName"));
future.cause().printStackTrace();
BackgroundService.RunCommand(context, new BackgroundService.InstanceCallback() {
@Override
public void onServiceStart(BackgroundService service) {

View File

@@ -23,9 +23,12 @@ package org.kde.kdeconnect.Helpers.SecurityHelpers;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
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;
@@ -42,7 +45,6 @@ import java.security.MessageDigest;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.Security;
import java.security.cert.X509Certificate;
import java.util.Date;
import java.util.Formatter;
@@ -50,6 +52,7 @@ 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;
@@ -81,7 +84,7 @@ public class SslHelper {
try {
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.O, "KDE");
Date notBefore = new Date(System.currentTimeMillis());
@@ -126,7 +129,7 @@ public class SslHelper {
PrivateKey privateKey = RsaHelper.getPrivateKey(context);
// Get remote device certificate if trusted
java.security.cert.Certificate remoteDeviceCertificate = null;
X509Certificate remoteDeviceCertificate = null;
if (isDeviceTrusted){
SharedPreferences devicePreferences = context.getSharedPreferences(deviceId, Context.MODE_PRIVATE);
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;
}catch (Exception e){
e.printStackTrace();