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

Removed spongycastle, now using bouncy castle version

Added reverse connection blacklist again
This commit is contained in:
Vineet Garg 2015-08-23 00:11:36 +05:30
parent 8cd59e701a
commit c4a27255a7
4 changed files with 36 additions and 18 deletions

View File

@ -35,6 +35,9 @@ android {
pickFirst "META-INF/DEPENDENCIES"
pickFirst "META-INF/LICENSE"
pickFirst "META-INF/NOTICE"
pickFirst "META-INF/BCKEY.SF"
pickFirst "META-INF/BCKEY.DSA"
pickFirst "META-INF/INDEX.LIST"
}
lintOptions {
abortOnError false
@ -54,14 +57,14 @@ dependencies {
}
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' // We use a custom build netty in libs directory due to ssl related bug
// compile fileTree(include: '*.jar', dir: 'libs')
compile 'org.bouncycastle:bcpkix-jdk15on:1.52'
compile 'org.bouncycastle:bcprov-jdk15on:1.52'
// compile 'io.netty:netty-handler:4.0.25.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')
}

View File

@ -88,6 +88,11 @@ public class LanLinkProvider extends BaseLinkProvider {
private TcpHandler tcpHandler = new TcpHandler();
private UdpHandler udpHandler = new UdpHandler();
// To prevent infinte loop if both device can only broadcast identity package but cannot connect via TCO
private ArrayList<String> reverseConnectionBlackList = new ArrayList<>();
private Timer reverseConnectionTimer;
@ChannelHandler.Sharable
private class TcpHandler extends SimpleChannelInboundHandler<String>{
@Override
@ -257,7 +262,17 @@ public class LanLinkProvider extends BaseLinkProvider {
if (!future.isSuccess()) {
Log.e("KDE/LanLinkProvider", "Cannot connect to " + identityPackage.getString("deviceId"));
// Try reverse connection
onNetworkChange();
if (!reverseConnectionBlackList.contains(identityPackage.getString("deviceId"))) {
reverseConnectionBlackList.add(identityPackage.getString("deviceId"));
reverseConnectionTimer = new Timer();
reverseConnectionTimer.schedule(new TimerTask() {
@Override
public void run() {
reverseConnectionBlackList.add(identityPackage.getString("deviceId"));
}
}, 5*1000);
onNetworkChange();
}
return;
}

View File

@ -35,15 +35,15 @@ import android.support.v4.app.NotificationCompat;
import android.util.Base64;
import android.util.Log;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.kde.kdeconnect.Backends.BaseLink;
import org.kde.kdeconnect.Backends.BasePairingHandler;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.Plugins.PluginFactory;
import org.kde.kdeconnect.UserInterface.PairActivity;
import org.kde.kdeconnect_tp.R;
import org.spongycastle.cert.X509CertificateHolder;
import org.spongycastle.cert.jcajce.JcaX509CertificateConverter;
import org.spongycastle.jce.provider.BouncyCastleProvider;
import java.security.KeyFactory;
import java.security.PrivateKey;

View File

@ -27,15 +27,15 @@ import android.provider.Settings;
import android.util.Base64;
import android.util.Log;
import org.spongycastle.asn1.x500.X500NameBuilder;
import org.spongycastle.asn1.x500.style.BCStyle;
import org.spongycastle.cert.X509CertificateHolder;
import org.spongycastle.cert.X509v3CertificateBuilder;
import org.spongycastle.cert.jcajce.JcaX509CertificateConverter;
import org.spongycastle.cert.jcajce.JcaX509v3CertificateBuilder;
import org.spongycastle.jce.provider.BouncyCastleProvider;
import org.spongycastle.operator.ContentSigner;
import org.spongycastle.operator.jcajce.JcaContentSignerBuilder;
import org.bouncycastle.asn1.x500.X500NameBuilder;
import org.bouncycastle.asn1.x500.style.BCStyle;
import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.X509v3CertificateBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter;
import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.operator.ContentSigner;
import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder;
import java.math.BigInteger;
import java.security.KeyStore;