diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-10-08 10:31:46 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-10-08 10:31:46 +0200 |
commit | ecf2d7c0930ec9031cdce8360a1d8009882b3c36 (patch) | |
tree | 417d00ebb0d2896344813cf37ffbd260cbd35d54 /src/main/java/de/pixart/messenger/utils | |
parent | 3d765be798645d1ae6f05775fb4e92a181f808c2 (diff) |
issue ping after push was received
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/CryptoHelper.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/CryptoHelper.java b/src/main/java/de/pixart/messenger/utils/CryptoHelper.java index 012ebf4d0..510f60352 100644 --- a/src/main/java/de/pixart/messenger/utils/CryptoHelper.java +++ b/src/main/java/de/pixart/messenger/utils/CryptoHelper.java @@ -25,6 +25,7 @@ import java.util.regex.Pattern; import de.pixart.messenger.Config; import de.pixart.messenger.R; +import de.pixart.messenger.entities.Account; import de.pixart.messenger.entities.Message; import de.pixart.messenger.xmpp.jid.InvalidJidException; import de.pixart.messenger.xmpp.jid.Jid; @@ -204,6 +205,15 @@ public final class CryptoHelper { return prettifyFingerprintCert(bytesToHex(fingerprint)); } + public static String getAccountFingerprint(Account account) { + try { + MessageDigest md = MessageDigest.getInstance("SHA-256"); + return bytesToHex(md.digest(account.getJid().toBareJid().toString().getBytes("UTF-8"))); + } catch (Exception e) { + return ""; + } + } + public static int encryptionTypeToText(int encryption) { switch (encryption) { case Message.ENCRYPTION_OTR: |