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
This commit is contained in:
iNPUTmice 2015-04-14 15:17:06 +02:00
commit defb127d6e
5 changed files with 28 additions and 5 deletions

View File

@ -532,9 +532,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
ExceptionHelper.init(getApplicationContext()); ExceptionHelper.init(getApplicationContext());
PRNGFixes.apply(); PRNGFixes.apply();
this.mRandom = new SecureRandom(); this.mRandom = new SecureRandom();
this.mMemorizingTrustManager = new MemorizingTrustManager( updateMemorizingTrustmanager();
getApplicationContext());
final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024); final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);
final int cacheSize = maxMemory / 8; final int cacheSize = maxMemory / 8;
this.mBitmapCache = new LruCache<String, Bitmap>(cacheSize) { this.mBitmapCache = new LruCache<String, Bitmap>(cacheSize) {
@ -2187,6 +2185,21 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
return this.mMemorizingTrustManager; 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() { public PowerManager getPowerManager() {
return this.pm; return this.pm;
} }

View File

@ -85,7 +85,8 @@ public class SettingsActivity extends XmppActivity implements
} }
} }
} }
} else if (name.equals("dont_trust_system_cas")) {
xmppConnectionService.updateMemorizingTrustmanager();
} }
} }
} }

View File

@ -429,6 +429,8 @@
<string name="received_location">Standort empfangen</string> <string name="received_location">Standort empfangen</string>
<string name="title_undo_swipe_out_conversation">Unterhaltung beendet</string> <string name="title_undo_swipe_out_conversation">Unterhaltung beendet</string>
<string name="title_undo_swipe_out_muc">Konferenz verlassen</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"> <plurals name="select_contact">
<item quantity="one">%d Kontakt ausgewählt</item> <item quantity="one">%d Kontakt ausgewählt</item>
<item quantity="other">%d Kontakte ausgewählt</item> <item quantity="other">%d Kontakte ausgewählt</item>

View File

@ -387,7 +387,7 @@
<string name="could_not_change_password">Could not change password</string> <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="otr_session_not_started">Send a message to start an encrypted chat</string>
<string name="ask_question">Ask question</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 others 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="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_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> <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="received_location">Received location</string>
<string name="title_undo_swipe_out_conversation">Conversation closed</string> <string name="title_undo_swipe_out_conversation">Conversation closed</string>
<string name="title_undo_swipe_out_muc">Left conference</string> <string name="title_undo_swipe_out_muc">Left conference</string>
<string name="pref_dont_trust_system_cas_title">Dont trust system CAs</string>
<string name="pref_dont_trust_system_cas_summary">All certificates must be manually approved</string>
<plurals name="select_contact"> <plurals name="select_contact">
<item quantity="one">Select %d contact</item> <item quantity="one">Select %d contact</item>
<item quantity="other">Select %d contacts</item> <item quantity="other">Select %d contacts</item>

View File

@ -147,6 +147,11 @@
android:key="keep_foreground_service" android:key="keep_foreground_service"
android:title="@string/pref_keep_foreground_service" android:title="@string/pref_keep_foreground_service"
android:summary="@string/pref_keep_foreground_service_summary" /> 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> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>