aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-01-15 11:40:32 +0100
committerChristian Schneppe <christian@pix-art.de>2017-01-15 11:40:32 +0100
commit0ff3c0b3b446fef371d8d768f78e65fc993b3386 (patch)
treef739380f4fcaf5f06885e8608ef73457aefccff9 /src
parentc2fe4b3a052d7ee6cd82c1951c7b712d3b28034b (diff)
don't allow to purge keys. offer distrust instead
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java6
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/FingerprintStatus.java10
-rw-r--r--src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/OmemoActivity.java21
-rw-r--r--src/main/res/menu/omemo_key_context.xml4
-rw-r--r--src/main/res/values-de/strings.xml2
-rw-r--r--src/main/res/values/strings.xml5
7 files changed, 27 insertions, 23 deletions
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
index 11f51eaa2..b889418c1 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/AxolotlService.java
@@ -436,8 +436,10 @@ public class AxolotlService implements OnAdvancedStreamFeaturesLoaded {
mXmppConnectionService.sendIqPacket(account, publish, null);
}
- public void purgeKey(final String fingerprint) {
- axolotlStore.setFingerprintStatus(fingerprint.replaceAll("\\s", ""), FingerprintStatus.createCompromised());
+ public void distrustFingerprint(final String fingerprint) {
+ final String fp = fingerprint.replaceAll("\\s", "");
+ final FingerprintStatus fingerprintStatus = axolotlStore.getFingerprintStatus(fp);
+ axolotlStore.setFingerprintStatus(fp, fingerprintStatus.toUntrusted());
}
public void publishOwnDeviceIdIfNeeded() {
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/FingerprintStatus.java b/src/main/java/de/pixart/messenger/crypto/axolotl/FingerprintStatus.java
index c38847be5..d47df0a0b 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/FingerprintStatus.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/FingerprintStatus.java
@@ -126,17 +126,17 @@ public class FingerprintStatus implements Comparable<FingerprintStatus> {
return trust;
}
- public static FingerprintStatus createCompromised() {
+ public FingerprintStatus toVerified() {
FingerprintStatus status = new FingerprintStatus();
- status.active = false;
- status.trust = Trust.COMPROMISED;
+ status.active = active;
+ status.trust = Trust.VERIFIED;
return status;
}
- public FingerprintStatus toVerified() {
+ public FingerprintStatus toUntrusted() {
FingerprintStatus status = new FingerprintStatus();
status.active = active;
- status.trust = Trust.VERIFIED;
+ status.trust = Trust.UNTRUSTED;
return status;
}
diff --git a/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java b/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java
index 59a7fc71f..6a314a760 100644
--- a/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java
+++ b/src/main/java/de/pixart/messenger/crypto/axolotl/XmppAxolotlSession.java
@@ -118,6 +118,8 @@ public class XmppAxolotlSession implements Comparable<XmppAxolotlSession> {
setTrust(status.toActive());
}
}
+ } else {
+ Log.d(Config.LOGTAG, account.getJid().toBareJid() + " not encrypting omemo message from fingerprint " + getFingerprint() + " because it was marked as compromised");
}
return plaintext;
}
diff --git a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java
index 9a708bbae..dfef4e200 100644
--- a/src/main/java/de/pixart/messenger/ui/OmemoActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/OmemoActivity.java
@@ -48,17 +48,19 @@ public abstract class OmemoActivity extends XmppActivity {
&& fingerprint instanceof String
&& fingerprintStatus instanceof FingerprintStatus) {
getMenuInflater().inflate(R.menu.omemo_key_context, menu);
- MenuItem purgeItem = menu.findItem(R.id.purge_omemo_key);
+ MenuItem distrust = menu.findItem(R.id.distrust_key);
MenuItem verifyScan = menu.findItem(R.id.verify_scan);
if (this instanceof TrustKeysActivity) {
- purgeItem.setVisible(false);
+ distrust.setVisible(false);
verifyScan.setVisible(false);
} else {
FingerprintStatus status = (FingerprintStatus) fingerprintStatus;
if (!status.isActive() || status.isVerified()) {
verifyScan.setVisible(false);
}
- } this.mSelectedAccount = (Account) account;
+ distrust.setVisible(status.isVerified());
+ }
+ this.mSelectedAccount = (Account) account;
this.mSelectedFingerprint = (String) fingerprint;
}
}
@@ -66,7 +68,7 @@ public abstract class OmemoActivity extends XmppActivity {
@Override
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
- case R.id.purge_omemo_key:
+ case R.id.distrust_key:
showPurgeKeyDialog(mSelectedAccount, mSelectedFingerprint);
break;
case R.id.copy_omemo_key:
@@ -239,17 +241,14 @@ public abstract class OmemoActivity extends XmppActivity {
public void showPurgeKeyDialog(final Account account, final String fingerprint) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(getString(R.string.purge_key));
- builder.setIconAttribute(android.R.attr.alertDialogIcon);
- builder.setMessage(getString(R.string.purge_key_desc_part1)
- + "\n\n" + CryptoHelper.prettifyFingerprint(fingerprint.substring(2))
- + "\n\n" + getString(R.string.purge_key_desc_part2));
+ builder.setTitle(R.string.distrust_omemo_key);
+ builder.setMessage(R.string.distrust_omemo_key_text);
builder.setNegativeButton(getString(R.string.cancel), null);
- builder.setPositiveButton(getString(R.string.purge_key),
+ builder.setPositiveButton(R.string.confirm,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- account.getAxolotlService().purgeKey(fingerprint);
+ account.getAxolotlService().distrustFingerprint(fingerprint);
refreshUi();
}
});
diff --git a/src/main/res/menu/omemo_key_context.xml b/src/main/res/menu/omemo_key_context.xml
index d372d4bd4..d57b4d7f7 100644
--- a/src/main/res/menu/omemo_key_context.xml
+++ b/src/main/res/menu/omemo_key_context.xml
@@ -5,8 +5,8 @@
android:title="@string/verify_with_qr_code"
/>
<item
- android:id="@+id/purge_omemo_key"
- android:title="@string/purge_key" />
+ android:id="@+id/distrust_key"
+ android:title="@string/distrust_omemo_key" />
<item
android:id="@+id/copy_omemo_key"
android:title="@string/copy_fingerprint" />
diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml
index 8bdb15c32..f871e5114 100644
--- a/src/main/res/values-de/strings.xml
+++ b/src/main/res/values-de/strings.xml
@@ -686,5 +686,7 @@
<string name="hide_inactive_devices">Verstecke inaktive Geräte</string>
<string name="reply">Antworten</string>
<string name="show_inactive_devices">Zeige inaktive Geräte</string>
+ <string name="distrust_omemo_key">Gerät misstrauen</string>
+ <string name="distrust_omemo_key_text">Bist du sicher, dass du die Verifizierung dieses Gerätes misstrauen möchtest? Dieses Gerät und Nachrichten von dem Gerät werden als unverifiziert markiert.</string>
</resources>
diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml
index cf534777b..86746dede 100644
--- a/src/main/res/values/strings.xml
+++ b/src/main/res/values/strings.xml
@@ -400,9 +400,8 @@
<string name="regenerate_omemo_key">Regenerate OMEMO key</string>
<string name="clear_other_devices">Clear devices</string>
<string name="clear_other_devices_desc">Are you sure you want to clear all other devices from the OMEMO announcement? The next time your devices connect, they will reannounce themselves, but they might not receive messages sent in the meantime.</string>
- <string name="purge_key">Purge key</string>
- <string name="purge_key_desc_part1">Are you sure you want to purge this key?</string>
- <string name="purge_key_desc_part2">It will irreversibly be considered compromised, and you can never build a session with it again.</string>
+ <string name="distrust_omemo_key">Distrust device</string>
+ <string name="distrust_omemo_key_text">Are you sure you want to remove the verification for this device?\nThis device and messages coming from that device will be marked as untrusted.</string>
<string name="error_no_keys_to_trust_server_error">There are no usable keys available for this contact.\nFetching new keys from the server has been unsuccessful. Maybe there is something wrong with your contacts server.</string>
<string name="error_no_keys_to_trust">There are no usable keys available for this contact. If you have purged any of their keys, they need to generate new ones.</string>
<string name="error_trustkeys_title">Error</string>