aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Straub <andy@strb.org>2015-07-07 19:28:35 +0200
committerAndreas Straub <andy@strb.org>2015-07-07 19:28:35 +0200
commit30403a70f25628beb7fce5c5193c0b5f61d31ebd (patch)
tree8c0797940bfb7ee7cc7ff252a3874241a80c1fbc
parent4b0279a6efbc2b03fc818d4cd69f214ca5393de2 (diff)
Adapt prettifyFingerprint() to axolotl FP sizes
-rw-r--r--src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java2
-rw-r--r--src/main/java/eu/siacs/conversations/utils/CryptoHelper.java9
2 files changed, 5 insertions, 6 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
index 2777b814..33861f82 100644
--- a/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
+++ b/src/main/java/eu/siacs/conversations/ui/ContactDetailsActivity.java
@@ -387,7 +387,7 @@ public class ContactDetailsActivity extends XmppActivity implements OnAccountUpd
.findViewById(R.id.button_remove);
remove.setVisibility(View.VISIBLE);
keyType.setText("Axolotl Fingerprint");
- key.setText(identityKey.getFingerprint());
+ key.setText(CryptoHelper.prettifyFingerprint(identityKey.getFingerprint()));
keys.addView(view);
remove.setOnClickListener(new OnClickListener() {
diff --git a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java
index 466bc409..8a1cf3e2 100644
--- a/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java
+++ b/src/main/java/eu/siacs/conversations/utils/CryptoHelper.java
@@ -94,11 +94,10 @@ public final class CryptoHelper {
if (fingerprint.length() < 40) {
return fingerprint;
}
- StringBuilder builder = new StringBuilder(fingerprint);
- builder.insert(8, " ");
- builder.insert(17, " ");
- builder.insert(26, " ");
- builder.insert(35, " ");
+ StringBuilder builder = new StringBuilder(fingerprint.replaceAll("\\s",""));
+ for(int i=8;i<builder.length();i+=9) {
+ builder.insert(i, ' ');
+ }
return builder.toString();
}