diff options
-rw-r--r-- | res/layout/dia_gatherentropy.xml | 13 | ||||
-rw-r--r-- | res/values/arrays.xml | 8 | ||||
-rw-r--r-- | res/values/strings.xml | 27 | ||||
-rw-r--r-- | res/xml/host_prefs.xml | 2 | ||||
-rw-r--r-- | src/org/connectbot/service/TerminalBridge.java | 31 | ||||
-rw-r--r-- | src/org/connectbot/util/EntropyView.java | 5 |
6 files changed, 62 insertions, 24 deletions
diff --git a/res/layout/dia_gatherentropy.xml b/res/layout/dia_gatherentropy.xml index 76a77b0..0dbb412 100644 --- a/res/layout/dia_gatherentropy.xml +++ b/res/layout/dia_gatherentropy.xml @@ -28,9 +28,16 @@ <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" - android:text="In order to assure randomness during the key generation, move your finger randomly over the box below." + android:text="@string/pubkey_touch_hint" android:textAppearance="?android:attr/textAppearanceMedium" android:gravity="center"/> - <org.connectbot.util.EntropyView android:id="@+id/entropy" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#666666ff" android:layout_marginBottom="10dip" android:layout_marginTop="10dip" android:drawingCacheQuality="auto"/> -</LinearLayout>
\ No newline at end of file + <org.connectbot.util.EntropyView + android:id="@+id/entropy" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#666666ff" + android:layout_marginBottom="10dip" + android:layout_marginTop="10dip" + android:drawingCacheQuality="auto"/> +</LinearLayout> diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 6286561..5893a0e 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -25,10 +25,10 @@ </string-array> <string-array name="list_colors"> - <item>red</item> - <item>green</item> - <item>blue</item> - <item>gray</item> + <item>@string/color_red</item> + <item>@string/color_green</item> + <item>@string/color_blue</item> + <item>@string/color_gray</item> </string-array> <string-array name="list_update"> diff --git a/res/values/strings.xml b/res/values/strings.xml index 2ec7d70..4ec0c88 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -36,7 +36,8 @@ <string name="pubkey_import">Import</string> <string name="pubkey_delete">Delete key</string> <string name="pubkey_gather_entropy">Gathering Entropy</string> - <string name="pubkey_touch_prompt">Touch this box to gather randomness: </string> + <string name="pubkey_touch_prompt">Touch this box to gather randomness: %1$d%% done</string> + <string name="pubkey_touch_hint">In order to assure randomness during the key generation, move your finger randomly over the box below.</string> <string name="pubkey_generating">Generating key pair...</string> <string name="pubkey_copy_private">Copy private key</string> <string name="pubkey_copy_public">Copy public key</string> @@ -76,6 +77,21 @@ <!-- Prompt for the password to unlock a certain pubkey. --> <string name="prompt_pubkey_password">Password for key '%1$s'</string> + <!-- The header of the warning a user gets when the host key has changed. Note that this can be a very serious attack, so we try to be as "loud" to the user as possible. --> + <string name="host_verification_failure_warning_header">WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!</string> + <!-- The body of the warning a user gets when the host key has changed. Note that this can be a very serious attack, so we try to be as "loud" to the user as possible. --> + <string name="host_verification_failure_warning">IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!\nSomeone could be eavesdropping on you right now (man-in-the-middle attack)!\nIt is also possible that the host key has just been changed.</string> + + <!-- Prompt user gets when the remote host has disconnected unexpectedly. --> + <string name="prompt_host_disconnected">Host has disconnected.\nClose session?</string> + <!-- Prompt user must answer yes or no to when the remote host fails verification of encryption fingerprint --> + <string name="prompt_continue_connecting">Are you sure you want\nto continue connecting?</string> + + <!-- Sent to user when the remote public encryption key fingerprint doesn't match the local database --> + <string name="host_authenticity_warning">The authenticity of host '%1$s' can't be established.</string> + <!-- First field is encryption algorithm. Second is the actual fingerprint in hex digits --> + <string name="host_fingerprint">Host %1$s key fingerprint is %2$s</string> + <string name="alert_passwords_do_not_match_msg">Passwords do not match!</string> <string name="alert_wrong_password_msg">Wrong password!</string> <string name="alert_key_corrupted_msg">Private key appears corrupt!</string> @@ -216,6 +232,8 @@ <!-- Host post-login automation preference title --> <string name="hostpref_postlogin_title">Post-login automation</string> + <!-- Host post-login automation preference summary --> + <string name="hostpref_postlogin_summary">Commands to run on remote server once authenticated</string> <!-- Host compression preference title --> <string name="hostpref_compression_title">Compression</string> @@ -354,7 +372,7 @@ <string name="terminal_auth_fail">[Your host doesn't support 'password' or 'keyboard-interactive' authentication.]</string> - <string name="local_shell_unavailable">Failure! Local shell is unavailable on this phone.</string> + <string name="local_shell_unavailable">Failure! Local shell is unavailable on this phone.</string> <!-- Dialog title when a new version of ConnectBot is detected. --> <string name="upgrade">New version</string> @@ -362,4 +380,9 @@ <string name="upgrade_pos">Yes, upgrade</string> <!-- Button selection to skip upgrading to the latest ConnectBot when one is available. --> <string name="upgrade_neg">Not right now</string> + + <string name="color_red">red</string> + <string name="color_green">green</string> + <string name="color_blue">blue</string> + <string name="color_gray">gray</string> </resources> diff --git a/res/xml/host_prefs.xml b/res/xml/host_prefs.xml index 387528a..8060e8a 100644 --- a/res/xml/host_prefs.xml +++ b/res/xml/host_prefs.xml @@ -47,7 +47,7 @@ <EditTextPreference android:key="postlogin" android:title="@string/hostpref_postlogin_title" - android:summary="Commands to run on remote server once authenticated" + android:summary="@string/hostpref_postlogin_summary" /> <CheckBoxPreference diff --git a/src/org/connectbot/service/TerminalBridge.java b/src/org/connectbot/service/TerminalBridge.java index 04b0c99..5477dd4 100644 --- a/src/org/connectbot/service/TerminalBridge.java +++ b/src/org/connectbot/service/TerminalBridge.java @@ -31,6 +31,7 @@ import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.security.spec.InvalidKeySpecException; +import java.util.Arrays; import java.util.LinkedList; import java.util.List; @@ -353,10 +354,10 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal case KnownHosts.HOSTKEY_IS_NEW: // prompt user - outputLine(String.format("The authenticity of host '%s' can't be established.", hostname)); - outputLine(String.format("Host %s key fingerprint is %s", algorithmName, fingerprint)); + outputLine(String.format(manager.res.getString(R.string.host_authenticity_warning), hostname)); + outputLine(String.format(manager.res.getString(R.string.host_fingerprint), algorithmName, fingerprint)); - result = promptHelper.requestBooleanPrompt("Are you sure you want\nto continue connecting?"); + result = promptHelper.requestBooleanPrompt(manager.res.getString(R.string.prompt_continue_connecting)); if(result == null) return false; if(result.booleanValue()) { // save this key in known database @@ -365,17 +366,22 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal return result.booleanValue(); case KnownHosts.HOSTKEY_HAS_CHANGED: - outputLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - outputLine("@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"); - outputLine("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - outputLine("IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!"); - outputLine("Someone could be eavesdropping on you right now (man-in-the-middle attack)!"); - outputLine("It is also possible that the host key has just been changed."); - outputLine(String.format("Host %s key fingerprint is %s", + String header = String.format("@ %s @", + manager.res.getString(R.string.host_verification_failure_warning_header)); + + char[] atsigns = new char[header.length()]; + Arrays.fill(atsigns, '@'); + String border = new String(atsigns); + + outputLine(border); + outputLine(manager.res.getString(R.string.host_verification_failure_warning)); + outputLine(border); + + outputLine(String.format(manager.res.getString(R.string.host_fingerprint), algorithmName, fingerprint)); // Users have no way to delete keys, so we'll prompt them for now. - result = promptHelper.requestBooleanPrompt("Are you sure you want\nto continue connecting?"); + result = promptHelper.requestBooleanPrompt(manager.res.getString(R.string.prompt_continue_connecting)); if(result == null) return false; if(result.booleanValue()) { // save this key in known database @@ -811,7 +817,8 @@ public class TerminalBridge implements VDUDisplay, OnKeyListener, InteractiveCal } else { new Thread(new Runnable() { public void run() { - Boolean result = promptHelper.requestBooleanPrompt("Host has disconnected.\nClose session?", true); + Boolean result = promptHelper.requestBooleanPrompt( + manager.res.getString(R.string.prompt_host_disconnected), true); if (result == null || result.booleanValue()) { awaitingClose = true; diff --git a/src/org/connectbot/util/EntropyView.java b/src/org/connectbot/util/EntropyView.java index 778a89a..55bebce 100644 --- a/src/org/connectbot/util/EntropyView.java +++ b/src/org/connectbot/util/EntropyView.java @@ -80,9 +80,10 @@ public class EntropyView extends View { listeners.remove(listener); } + @Override public void onDraw(Canvas c) { - String prompt = getResources().getString(R.string.pubkey_touch_prompt) - + " " + (int)(100.0 * (mEntropyIdx / 20.0)) + "% done"; + String prompt = String.format(getResources().getString(R.string.pubkey_touch_prompt), + (int)(100.0 * (mEntropyIdx / 20.0))); if (splitText > 0 || mPaint.measureText(prompt) > (getWidth() * 0.8)) { if (splitText == 0) |