fix incorrect sig

This commit is contained in:
gdlbo
2023-06-10 20:32:06 +03:00
parent 449ba8c768
commit 94236c87e3
@@ -19,11 +19,8 @@ import static ru.vtosters.hooks.other.Preferences.isValidSignature;
public class GcmHook { public class GcmHook {
private static final String agent = String.format("Android-GCM/1.5 (%s %s)", Build.MODEL, Build.MODEL); private static final String agent = String.format("Android-GCM/1.5 (%s %s)", Build.MODEL, Build.MODEL);
private static KeyPair pair; private static KeyPair pair;
private static int rid = 0; private static int rid = 0;
static { static {
@@ -35,15 +32,15 @@ public class GcmHook {
} }
public static String requestToken(String orig) { public static String requestToken(String orig) {
return "yssp9o9p9pamz5t-nvmq8spgwtin3e0=="; return isValidSignature() ? "yssp9o9p9pamz5t-nvmq8spgwtin3e0==" : requestToken();
} }
public static String requestToken() { public static String requestToken() {
String xappide;
try { try {
String aid = getRandomAid(); String aid = getRandomAid();
String pub2 = genNewKey(); String pub2 = genNewKey();
String sig = getSig(pub2); String sig = getSig(pub2);
String xappide;
try { try {
byte[] bytes = MessageDigest.getInstance("SHA1").digest(pair.getPublic().getEncoded()); byte[] bytes = MessageDigest.getInstance("SHA1").digest(pair.getPublic().getEncoded());
bytes[0] = (byte) (((bytes[0] & 15) + 112) & 255); bytes[0] = (byte) (((bytes[0] & 15) + 112) & 255);
@@ -200,7 +197,6 @@ public class GcmHook {
}).getBytes(StandardCharsets.UTF_8)); }).getBytes(StandardCharsets.UTF_8));
return Base64.encodeToString(sign.sign(), 0); return Base64.encodeToString(sign.sign(), 0);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
return null; return null;
} }
} }