summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-09 23:58:37 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-09 23:58:37 +0200
commit93504079cd041c2fe4468ef346d150969c512f16 (patch)
tree44183de4cdc25d1e120f88305045529ff9026e49
parentdd43bc7edc3e0d1fc5db8ba94e2e931799bc93bc (diff)
add cipher option
-rw-r--r--AndroidManifest.xml4
-rw-r--r--res/values/strings.xml4
-rw-r--r--res/xml/vpn_authentification.xml12
-rw-r--r--res/xml/vpn_headers.xml3
-rw-r--r--src/de/blinkt/openvpn/Settings_Authentication.java13
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java11
6 files changed, 40 insertions, 7 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index bc3f311c..b6cdc32b 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -17,8 +17,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.blinkt.openvpn"
- android:versionCode="21"
- android:versionName="0.5.0" >
+ android:versionCode="22"
+ android:versionName="0.5.1" >
<uses-permission android:name="android.permission.INTERNET" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 90009e8c..9073c0be 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -185,4 +185,8 @@
<string name="faq_shortcut">Shortcut to start</string>
<string name="faq_howto_shortcut">You can place a shortcut to start OpenVPN on your desktop. Depending on your homescreen program you have to add a shortcut or a widget.</string>
<string name="no_vpn_support_image">Your image does not support the VPNService API,sorry :(</string>
+ <string name="encryption">Encryption</string>
+ <string name="cipher_dialog_title">Enter Encryption method</string>
+ <string name="chipher_dialog_message">Enter the cipher key for openvpn. Leave empty to use default cipher</string>
+ <string name="settings_auth">Authentication/Encryption</string>
</resources>
diff --git a/res/xml/vpn_authentification.xml b/res/xml/vpn_authentification.xml
index bd8d8ca5..79d69697 100644
--- a/res/xml/vpn_authentification.xml
+++ b/res/xml/vpn_authentification.xml
@@ -28,14 +28,20 @@
android:title="@string/tls_auth_file" />
<ListPreference
+ android:dependency="useTLSAuth"
android:entries="@array/tls_directions_entries"
- android:dependency="useTLSAuth"
-
android:entryValues="@array/tls_directions_values"
android:key="tls_direction"
android:persistent="false"
android:title="@string/tls_direction" />
</PreferenceCategory>
-/>
+ <PreferenceCategory android:title="@string/encryption" >
+ <EditTextPreference
+ android:dialogMessage="@string/chipher_dialog_message"
+ android:dialogTitle="@string/cipher_dialog_title"
+ android:key="cipher"
+ android:persistent="false"
+ android:title="Encryption cipher" />
+ </PreferenceCategory>
</PreferenceScreen> \ No newline at end of file
diff --git a/res/xml/vpn_headers.xml b/res/xml/vpn_headers.xml
index f755dc8c..60ddce7c 100644
--- a/res/xml/vpn_headers.xml
+++ b/res/xml/vpn_headers.xml
@@ -15,8 +15,7 @@
android:title="IP Settings" />
<header
android:fragment="de.blinkt.openvpn.Settings_Authentication"
- android:summary="Authentication"
- android:title="Authentication" />
+ android:title="@string/settings_auth" />
<!-- android:icon="@drawable/ic_settings_display" -->
<header
diff --git a/src/de/blinkt/openvpn/Settings_Authentication.java b/src/de/blinkt/openvpn/Settings_Authentication.java
index 57d99417..6d21ca6a 100644
--- a/src/de/blinkt/openvpn/Settings_Authentication.java
+++ b/src/de/blinkt/openvpn/Settings_Authentication.java
@@ -24,6 +24,7 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre
private ListPreference mTLSAuthDirection;
private Preference mTLSAuthFile;
private SwitchPreference mUseTLSAuth;
+ private EditTextPreference mCipher;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -45,6 +46,8 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre
mProfile = ProfileManager.get(profileUUID);
mTLSAuthFile.setOnPreferenceClickListener(this);
+ mCipher =(EditTextPreference) findPreference("cipher");
+
loadSettings();
}
@@ -59,6 +62,8 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre
mUseTLSAuth.setChecked(mProfile.mUseTLSAuth);
mTLSAuthFile.setSummary(mProfile.mTLSAuthFilename);
mTLSAuthDirection.setValue(mProfile.mTLSAuthDirection);
+ mCipher.setText(mProfile.mCipher);
+ onPreferenceChange(mCipher, mProfile.mCipher);
}
private void saveSettings() {
@@ -76,6 +81,12 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre
mProfile.mTLSAuthDirection=null;
else
mProfile.mTLSAuthDirection = mTLSAuthDirection.getValue().toString();
+
+ if(mCipher.getText()==null)
+ mProfile.mCipher=null;
+ else
+ mProfile.mCipher = mCipher.getText();
+
}
@Override
@@ -91,6 +102,8 @@ public class Settings_Authentication extends PreferenceFragment implements OnPre
preference.setSummary(mProfile.mServerName);
else
preference.setSummary((String)newValue);
+ } else if (preference == mCipher) {
+ preference.setSummary((CharSequence) newValue);
}
return true;
}
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index c18575da..1b855f5d 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -90,6 +90,7 @@ public class VpnProfile implements Serializable{
public boolean mUseCustomConfig=false;
public String mCustomConfigOptions="";
public String mVerb="1";
+ public String mCipher="";
public static String openVpnEscape(String unescaped) {
@@ -271,6 +272,9 @@ public class VpnProfile implements Serializable{
cfg += "remote-cert-tls server\n";
+ if(nonNull(mCipher)){
+ cfg += "cipher " + mCipher + "\n";
+ }
// Obscure Settings dialog
@@ -293,6 +297,13 @@ public class VpnProfile implements Serializable{
return cfg;
}
+ private boolean nonNull(String val) {
+ if(val == null || val.equals(""))
+ return false;
+ else
+ return true;
+ }
+
private Collection<String> getCustomRoutes() {
Vector<String> cidrRoutes=new Vector<String>();
if(mCustomRoutes==null) {