diff options
author | Arne Schwabe <arne@rfc2549.org> | 2013-02-02 16:37:43 +0100 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2013-02-02 16:37:43 +0100 |
commit | f00cd03f5aa1f8042b55ebee5050d297cef6bb8a (patch) | |
tree | d6366f6696889de81932df08bec243f06e547cf2 | |
parent | dbd9cf8fadb8d2911a20ad4fd3ddb708a7b77dba (diff) |
Add the --auth option to the auth/enc dialog
-rwxr-xr-x | res/values/strings.xml | 9 | ||||
-rw-r--r-- | res/xml/vpn_authentification.xml | 8 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/ConfigParser.java | 5 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/Settings_Authentication.java | 13 | ||||
-rw-r--r-- | src/de/blinkt/openvpn/VpnProfile.java | 4 |
5 files changed, 35 insertions, 4 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index ff9db139..f1bd9bd9 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -126,7 +126,8 @@ <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="chipher_dialog_message">Enter the encryption cipher alogithm used by OpenVPN. Leave empty to use default cipher.</string> + <string name="auth_dialog_message">Enter the authentication digest used for OpenVPN. Leave empty to use default digest.</string> <string name="settings_auth">Authentication/Encryption</string> <string name="file_explorer_tab">File Explorer</string> <string name="inline_file_tab">Inline File</string> @@ -256,4 +257,8 @@ <string name="statusline_bytecount">In: %8$1s %8$2s/s Out: %8$3s %8$4s/s</string> <string name="notifcation_title_notconnect">Not connected</string> <string name="jelly_keystore_alphanumeric_bug">Some versions of Android 4.1 have problem if the name of the keystore certificate contains non alphanumeric character (like spaces or dashes)</string> -</resources> + <string name="encryption_cipher">Encryption cipher</string> + <string name="packet_auth">Packets authentication</string> + <string name="auth_dialog_title">Enter packet authentication method</string> + +</resources>
\ No newline at end of file diff --git a/res/xml/vpn_authentification.xml b/res/xml/vpn_authentification.xml index 99e0f3e8..619890c7 100644 --- a/res/xml/vpn_authentification.xml +++ b/res/xml/vpn_authentification.xml @@ -41,7 +41,13 @@ android:dialogTitle="@string/cipher_dialog_title" android:key="cipher" android:persistent="false" - android:title="Encryption cipher" /> + android:title="@string/encryption_cipher" /> + <EditTextPreference + android:dialogMessage="@string/auth_dialog_message" + android:dialogTitle="@string/auth_dialog_title" + android:key="auth" + android:persistent="false" + android:title="@string/packet_auth" /> </PreferenceCategory> </PreferenceScreen>
\ No newline at end of file diff --git a/src/de/blinkt/openvpn/ConfigParser.java b/src/de/blinkt/openvpn/ConfigParser.java index dc605bbc..99e7ec93 100644 --- a/src/de/blinkt/openvpn/ConfigParser.java +++ b/src/de/blinkt/openvpn/ConfigParser.java @@ -388,6 +388,11 @@ public class ConfigParser { if(cipher!=null) np.mCipher= cipher.get(1); + Vector<String> auth = getOption("auth", 1, 1); + if(auth!=null) + np.mAuth = auth.get(1); + + Vector<String> ca = getOption("ca",1,1); if(ca!=null){ np.mCaFilename = ca.get(1); diff --git a/src/de/blinkt/openvpn/Settings_Authentication.java b/src/de/blinkt/openvpn/Settings_Authentication.java index 6733ed0c..4e3f1e6f 100644 --- a/src/de/blinkt/openvpn/Settings_Authentication.java +++ b/src/de/blinkt/openvpn/Settings_Authentication.java @@ -23,6 +23,7 @@ public class Settings_Authentication extends OpenVpnPreferencesFragment implemen private SwitchPreference mUseTLSAuth; private EditTextPreference mCipher; private String mTlsAuthFileData; + private EditTextPreference mAuth; @Override public void onCreate(Bundle savedInstanceState) { @@ -46,6 +47,9 @@ public class Settings_Authentication extends OpenVpnPreferencesFragment implemen mCipher =(EditTextPreference) findPreference("cipher"); mCipher.setOnPreferenceChangeListener(this); + mAuth =(EditTextPreference) findPreference("auth"); + mAuth.setOnPreferenceChangeListener(this); + loadSettings(); } @@ -64,6 +68,8 @@ public class Settings_Authentication extends OpenVpnPreferencesFragment implemen mTLSAuthDirection.setValue(mProfile.mTLSAuthDirection); mCipher.setText(mProfile.mCipher); onPreferenceChange(mCipher, mProfile.mCipher); + mAuth.setText(mProfile.mAuth); + onPreferenceChange(mAuth, mProfile.mAuth); } @Override @@ -85,6 +91,11 @@ public class Settings_Authentication extends OpenVpnPreferencesFragment implemen else mProfile.mCipher = mCipher.getText(); + if(mAuth.getText()==null) + mProfile.mAuth = null; + else + mProfile.mAuth = mAuth.getText(); + } @@ -96,7 +107,7 @@ public class Settings_Authentication extends OpenVpnPreferencesFragment implemen preference.setSummary(mProfile.mServerName); else preference.setSummary((String)newValue); - } else if (preference == mCipher) { + } else if (preference == mCipher || preference == mAuth) { preference.setSummary((CharSequence) newValue); } return true; diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java index 74f01a3b..6f21397e 100644 --- a/src/de/blinkt/openvpn/VpnProfile.java +++ b/src/de/blinkt/openvpn/VpnProfile.java @@ -106,6 +106,7 @@ public class VpnProfile implements Serializable{ public String mConnectRetryMax="5"; public String mConnectRetry="5"; public boolean mUserEditable=true; + public String mAuth=""; static final String MINIVPN = "miniopenvpn"; @@ -349,6 +350,9 @@ public class VpnProfile implements Serializable{ cfg += "cipher " + mCipher + "\n"; } + if(nonNull(mAuth)) { + cfg += "auth " + mAuth + "\n"; + } // Obscure Settings dialog if(mUseRandomHostname) |