diff options
author | iNPUTmice <daniel@gultsch.de> | 2015-04-14 15:17:26 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2015-04-14 15:17:26 +0200 |
commit | b6cc8c90a00f55866ea906697a40f582643309c2 (patch) | |
tree | b220ef33d771667032a1cc2c62b0587a09a27ff9 /src/main | |
parent | 261b505f066b90ef346c529afea50f8285ddfd7d (diff) | |
parent | defb127d6e3a1d29f60553a8e9b3f992f2127b70 (diff) |
Merge branch 'BrianBlade-dont_trust_cas_preference' into development
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 19 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/ui/SettingsActivity.java | 3 | ||||
-rw-r--r-- | src/main/res/values-de/strings.xml | 2 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 4 | ||||
-rw-r--r-- | src/main/res/xml/preferences.xml | 5 |
5 files changed, 28 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 669ad62c..3e8ce65f 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -532,9 +532,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa ExceptionHelper.init(getApplicationContext()); PRNGFixes.apply(); this.mRandom = new SecureRandom(); - this.mMemorizingTrustManager = new MemorizingTrustManager( - getApplicationContext()); - + updateMemorizingTrustmanager(); final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); final int cacheSize = maxMemory / 8; this.mBitmapCache = new LruCache<String, Bitmap>(cacheSize) { @@ -2187,6 +2185,21 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa return this.mMemorizingTrustManager; } + public void setMemorizingTrustManager(MemorizingTrustManager trustManager) { + this.mMemorizingTrustManager = trustManager; + } + + public void updateMemorizingTrustmanager() { + final MemorizingTrustManager tm; + final boolean dontTrustSystemCAs = getPreferences().getBoolean("dont_trust_system_cas", false); + if (dontTrustSystemCAs) { + tm = new MemorizingTrustManager(getApplicationContext(), null); + } else { + tm = new MemorizingTrustManager(getApplicationContext()); + } + setMemorizingTrustManager(tm); + } + public PowerManager getPowerManager() { return this.pm; } diff --git a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java index e3cb2ee7..d24cb52b 100644 --- a/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/SettingsActivity.java @@ -85,7 +85,8 @@ public class SettingsActivity extends XmppActivity implements } } } + } else if (name.equals("dont_trust_system_cas")) { + xmppConnectionService.updateMemorizingTrustmanager(); } } - } diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 3f6f471b..addc55de 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -429,6 +429,8 @@ <string name="received_location">Standort empfangen</string> <string name="title_undo_swipe_out_conversation">Unterhaltung beendet</string> <string name="title_undo_swipe_out_muc">Konferenz verlassen</string> + <string name="pref_dont_trust_system_cas_title">Misstraue Zertifizierungsstellen</string> + <string name="pref_dont_trust_system_cas_summary">Alle Zertifikate müssen manuell bestätigt werden</string> <plurals name="select_contact"> <item quantity="one">%d Kontakt ausgewählt</item> <item quantity="other">%d Kontakte ausgewählt</item> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 50e9d9e4..4a36163c 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -387,7 +387,7 @@ <string name="could_not_change_password">Could not change password</string> <string name="otr_session_not_started">Send a message to start an encrypted chat</string> <string name="ask_question">Ask question</string> - <string name="smp_explain_question">If you and your contact have a secret in common that no one else knows (like an inside joke or simply what you had for lunch the last time you met) you can use that secret to verify each other\'s fingerprints.\n\nYou provide a hint or a question for your contact who will respond with a case-sensitive answer.</string> + <string name="smp_explain_question">If you and your contact have a secret in common that no one else knows (like an inside joke or simply what you had for lunch the last time you met) you can use that secret to verify each other’s fingerprints.\n\nYou provide a hint or a question for your contact who will respond with a case-sensitive answer.</string> <string name="smp_explain_answer">Your contact would like to verify your fingerprint by challenging you with a shared secret. Your contact provided the following hint or question for that secret.</string> <string name="shared_secret_hint_should_not_be_empty">Your hint should not be empty</string> <string name="shared_secret_can_not_be_empty">Your shared secret can not be empty</string> @@ -457,6 +457,8 @@ <string name="received_location">Received location</string> <string name="title_undo_swipe_out_conversation">Conversation closed</string> <string name="title_undo_swipe_out_muc">Left conference</string> + <string name="pref_dont_trust_system_cas_title">Don’t trust system CAs</string> + <string name="pref_dont_trust_system_cas_summary">All certificates must be manually approved</string> <plurals name="select_contact"> <item quantity="one">Select %d contact</item> <item quantity="other">Select %d contacts</item> diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 8bf6eb87..d48124a6 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -147,6 +147,11 @@ android:key="keep_foreground_service" android:title="@string/pref_keep_foreground_service" android:summary="@string/pref_keep_foreground_service_summary" /> + <CheckBoxPreference + android:defaultValue="false" + android:key="dont_trust_system_cas" + android:title="@string/pref_dont_trust_system_cas_title" + android:summary="@string/pref_dont_trust_system_cas_summary" /> </PreferenceCategory> </PreferenceScreen> |