From ecf2d7c0930ec9031cdce8360a1d8009882b3c36 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sat, 8 Oct 2016 10:31:46 +0200 Subject: issue ping after push was received --- src/main/java/de/pixart/messenger/utils/CryptoHelper.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/java/de/pixart/messenger/utils') 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: -- cgit v1.2.3