diff options
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: |