use NetCipher to get improved TLS and cipher support on HTTPS connections
The NetCipher library creates instances of HttpURLConnection that are configured to have solid TLS protocol and cipher settings, especially on older versions of Android. fixes #370 https://gitlab.com/fdroid/fdroidclient/issues/370
This commit is contained in:
parent
853e281710
commit
2c88703588
@ -24,6 +24,7 @@ if (!hasProperty('sourceDeps')) {
|
|||||||
compile 'com.google.zxing:core:3.2.1'
|
compile 'com.google.zxing:core:3.2.1'
|
||||||
compile 'eu.chainfire:libsuperuser:1.0.0.201504231659'
|
compile 'eu.chainfire:libsuperuser:1.0.0.201504231659'
|
||||||
compile 'cc.mvdan.accesspoint:library:0.1.1'
|
compile 'cc.mvdan.accesspoint:library:0.1.1'
|
||||||
|
compile 'info.guardianproject.netcipher:netcipher:1.2'
|
||||||
|
|
||||||
// We use a slightly modified spongycastle, see
|
// We use a slightly modified spongycastle, see
|
||||||
// openkeychain/spongycastle with some changes on top of 1.51.0.0
|
// openkeychain/spongycastle with some changes on top of 1.51.0.0
|
||||||
|
4
F-Droid/proguard-rules.pro
vendored
4
F-Droid/proguard-rules.pro
vendored
@ -10,6 +10,10 @@
|
|||||||
-dontnote android.support.**
|
-dontnote android.support.**
|
||||||
-dontnote **ILicensingService
|
-dontnote **ILicensingService
|
||||||
|
|
||||||
|
# StrongHttpsClient and its support classes are totally unused, so the
|
||||||
|
# ch.boye.httpclientandroidlib.** classes are also unneeded
|
||||||
|
-dontwarn info.guardianproject.netcipher.client.**
|
||||||
|
|
||||||
# These libraries are known to break if minification is enabled on them. They
|
# These libraries are known to break if minification is enabled on them. They
|
||||||
# use reflection to instantiate classes, for example. If the keep flags are
|
# use reflection to instantiate classes, for example. If the keep flags are
|
||||||
# removed, proguard will strip classes which are required, which may result in
|
# removed, proguard will strip classes which are required, which may result in
|
||||||
|
@ -8,7 +8,6 @@ import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
|
|||||||
import org.fdroid.fdroid.Preferences;
|
import org.fdroid.fdroid.Preferences;
|
||||||
import org.fdroid.fdroid.Utils;
|
import org.fdroid.fdroid.Utils;
|
||||||
|
|
||||||
import javax.net.ssl.SSLHandshakeException;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -20,6 +19,10 @@ import java.net.Proxy;
|
|||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
import javax.net.ssl.SSLHandshakeException;
|
||||||
|
|
||||||
|
import info.guardianproject.netcipher.NetCipher;
|
||||||
|
|
||||||
public class HttpDownloader extends Downloader {
|
public class HttpDownloader extends Downloader {
|
||||||
private static final String TAG = "HttpDownloader";
|
private static final String TAG = "HttpDownloader";
|
||||||
|
|
||||||
@ -88,10 +91,11 @@ public class HttpDownloader extends Downloader {
|
|||||||
if (prefs.isProxyEnabled()) {
|
if (prefs.isProxyEnabled()) {
|
||||||
SocketAddress sa = new InetSocketAddress(prefs.getProxyHost(), prefs.getProxyPort());
|
SocketAddress sa = new InetSocketAddress(prefs.getProxyHost(), prefs.getProxyPort());
|
||||||
Proxy proxy = new Proxy(Proxy.Type.HTTP, sa);
|
Proxy proxy = new Proxy(Proxy.Type.HTTP, sa);
|
||||||
connection = (HttpURLConnection) sourceUrl.openConnection(proxy);
|
NetCipher.setProxy(proxy);
|
||||||
} else {
|
} else {
|
||||||
connection = (HttpURLConnection) sourceUrl.openConnection();
|
NetCipher.setProxy(null);
|
||||||
}
|
}
|
||||||
|
connection = NetCipher.getHttpURLConnection(sourceUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void doDownload() throws IOException, InterruptedException {
|
protected void doDownload() throws IOException, InterruptedException {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user