summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/VpnProfile.java20
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/NativeUtils.java7
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java19
3 files changed, 18 insertions, 28 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/VpnProfile.java b/app/src/main/java/de/blinkt/openvpn/VpnProfile.java
index 1d6f41cd..1cef6670 100644
--- a/app/src/main/java/de/blinkt/openvpn/VpnProfile.java
+++ b/app/src/main/java/de/blinkt/openvpn/VpnProfile.java
@@ -5,7 +5,6 @@
package de.blinkt.openvpn;
-import de.blinkt.openvpn.core.Preferences;
import se.leap.bitmaskclient.BuildConfig;
import se.leap.bitmaskclient.R;
@@ -23,6 +22,7 @@ import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Base64;
+import de.blinkt.openvpn.core.*;
import org.spongycastle.util.io.pem.PemObject;
import org.spongycastle.util.io.pem.PemWriter;
@@ -35,11 +35,7 @@ import java.io.Serializable;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.Signature;
-import java.security.SignatureException;
+import java.security.*;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@@ -54,14 +50,6 @@ import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
-import de.blinkt.openvpn.core.Connection;
-import de.blinkt.openvpn.core.NativeUtils;
-import de.blinkt.openvpn.core.OpenVPNService;
-import de.blinkt.openvpn.core.PasswordCache;
-import de.blinkt.openvpn.core.VPNLaunchHelper;
-import de.blinkt.openvpn.core.VpnStatus;
-import de.blinkt.openvpn.core.X509Utils;
-
public class VpnProfile implements Serializable, Cloneable {
// Note that this class cannot be moved to core where it belongs since
// the profile loading depends on it being here
@@ -289,7 +277,7 @@ public class VpnProfile implements Serializable, Cloneable {
public static boolean doUseOpenVPN3(Context c) {
SharedPreferences prefs = Preferences.getDefaultSharedPreferences(c);
boolean useOpenVPN3 = prefs.getBoolean("ovpn3", false);
- if ("noovpn3".equals(BuildConfig.FLAVOR))
+ if (!BuildConfig.openvpn3)
useOpenVPN3 = false;
return useOpenVPN3;
}
@@ -1091,7 +1079,7 @@ public class VpnProfile implements Serializable, Cloneable {
return mPrivateKey;
}
- public String getSignedData(String b64data, boolean ecdsa) {
+ public String getSignedData(String b64data) {
PrivateKey privkey = getKeystoreKey();
byte[] data = Base64.decode(b64data, Base64.DEFAULT);
diff --git a/app/src/main/java/de/blinkt/openvpn/core/NativeUtils.java b/app/src/main/java/de/blinkt/openvpn/core/NativeUtils.java
index ea003d41..70c7455a 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/NativeUtils.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/NativeUtils.java
@@ -18,6 +18,13 @@ public class NativeUtils {
public static native String getNativeAPI();
+
+ public final static int[] openSSLlengths = {
+ 16, 64, 256, 1024, 8 * 1024, 16 * 1024
+ };
+
+ public static native double[] getOpenSSLSpeed(String algorithm, int testnum);
+
static {
System.loadLibrary("opvpnutil");
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.JELLY_BEAN)
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
index 1124c5b7..2b6df9af 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVpnManagementThread.java
@@ -148,6 +148,7 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
// Closing one of the two sockets also closes the other
//mServerSocketLocal.close();
+ managmentCommand("version 2\n");
while (true) {
@@ -259,11 +260,8 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
case "LOG":
processLogMessage(argument);
break;
- case "RSA_SIGN":
- processSignCommand(argument, false);
- break;
- case "ECDSA_SIGN":
- processSignCommand(argument, true);
+ case "PK_SIGN":
+ processSignCommand(argument);
break;
default:
VpnStatus.logWarning("MGMT: Got unrecognized command" + command);
@@ -634,20 +632,17 @@ public class OpenVpnManagementThread implements Runnable, OpenVPNManagement {
releaseHold();
}
- private void processSignCommand(String b64data, boolean ecdsa) {
+ private void processSignCommand(String b64data) {
- String signed_string = mProfile.getSignedData(b64data, ecdsa);
- String signcmd = "rsa-sig\n";
- if (ecdsa)
- signcmd = "ecdsa-sig\n";
+ String signed_string = mProfile.getSignedData(b64data);
if (signed_string == null) {
- managmentCommand(signcmd);
+ managmentCommand("pk-sig\n");
managmentCommand("\nEND\n");
stopOpenVPN();
return;
}
- managmentCommand(signcmd);
+ managmentCommand("pk-sig\n");
managmentCommand(signed_string);
managmentCommand("\nEND\n");
}