aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de')
-rw-r--r--src/main/java/de/pixart/messenger/generator/IqGenerator.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java2
-rw-r--r--src/main/java/de/pixart/messenger/utils/CryptoHelper.java6
-rw-r--r--src/main/java/de/pixart/messenger/utils/PhoneHelper.java7
4 files changed, 12 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/generator/IqGenerator.java b/src/main/java/de/pixart/messenger/generator/IqGenerator.java
index fbb47a2c6..e2c71c49d 100644
--- a/src/main/java/de/pixart/messenger/generator/IqGenerator.java
+++ b/src/main/java/de/pixart/messenger/generator/IqGenerator.java
@@ -407,7 +407,7 @@ public class IqGenerator extends AbstractGenerator {
command.setAttribute("action", "execute");
Data data = new Data();
data.put("token", token);
- data.put("device-id", deviceId);
+ data.put("android-id", deviceId);
data.submit();
command.addChild(data);
return packet;
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index cae50e6e5..1f038ab56 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -691,7 +691,7 @@ public class XmppConnectionService extends Service {
pingNow |= processAccountState(account,
interactive,
"ui".equals(action),
- CryptoHelper.getAccountFingerprint(account).equals(pushedAccountHash),
+ CryptoHelper.getAccountFingerprint(account, PhoneHelper.getAndroidId(this)).equals(pushedAccountHash),
pingCandidates);
}
if (pingNow) {
diff --git a/src/main/java/de/pixart/messenger/utils/CryptoHelper.java b/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
index 8cb68b34d..2327f6f96 100644
--- a/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
@@ -222,13 +222,13 @@ public final class CryptoHelper {
return prettifyFingerprintCert(bytesToHex(fingerprint));
}
- public static String getAccountFingerprint(Account account) {
- return getFingerprint(account.getJid().asBareJid().toString());
+ public static String getAccountFingerprint(Account account, String androidId) {
+ return getFingerprint(account.getJid().asBareJid().toEscapedString() + "\00" + androidId);
}
public static String getFingerprint(String value) {
try {
- MessageDigest md = MessageDigest.getInstance("SHA-256");
+ MessageDigest md = MessageDigest.getInstance("SHA-1");
return bytesToHex(md.digest(value.getBytes("UTF-8")));
} catch (Exception e) {
return "";
diff --git a/src/main/java/de/pixart/messenger/utils/PhoneHelper.java b/src/main/java/de/pixart/messenger/utils/PhoneHelper.java
index 452a31adc..f5e2ffde1 100644
--- a/src/main/java/de/pixart/messenger/utils/PhoneHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/PhoneHelper.java
@@ -1,6 +1,7 @@
package de.pixart.messenger.utils;
import android.Manifest;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.content.CursorLoader;
import android.content.pm.PackageManager;
@@ -10,6 +11,7 @@ import android.os.Build;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Profile;
+import android.provider.Settings;
import java.util.ArrayList;
import java.util.List;
@@ -17,6 +19,11 @@ import java.util.concurrent.RejectedExecutionException;
public class PhoneHelper {
+ @SuppressLint("HardwareIds")
+ public static String getAndroidId(Context context) {
+ return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
+ }
+
public static void loadPhoneContacts(Context context, final OnPhoneContactsLoadedListener listener) {
final List<Bundle> phoneContacts = new ArrayList<>();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M