aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-04-14 15:17:06 +0200
committeriNPUTmice <daniel@gultsch.de>2015-04-14 15:17:06 +0200
commitdefb127d6e3a1d29f60553a8e9b3f992f2127b70 (patch)
treeb220ef33d771667032a1cc2c62b0587a09a27ff9 /src
parent261b505f066b90ef346c529afea50f8285ddfd7d (diff)
parent878066ca99c1170479fb217d68ecdb9cf5498975 (diff)
Merge branch 'dont_trust_cas_preference' of https://github.com/BrianBlade/Conversations into BrianBlade-dont_trust_cas_preference
Conflicts: src/main/res/values-de/strings.xml src/main/res/values/strings.xml
Diffstat (limited to 'src')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java19
-rw-r--r--src/main/java/eu/siacs/conversations/ui/SettingsActivity.java3
-rw-r--r--src/main/res/values-de/strings.xml2
-rw-r--r--src/main/res/values/strings.xml4
-rw-r--r--src/main/res/xml/preferences.xml5
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>