Only skip encryption/decryption for JSON and the dummy key
authorChristian Weiske <cweiske@cweiske.de>
Sun, 2 Feb 2020 13:19:55 +0000 (14:19 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Sun, 2 Feb 2020 13:19:55 +0000 (14:19 +0100)
Resolves: https://github.com/cweiske/xposed-ouya-plain-purchases/issues/2

xposed-ouya-plain-purchases/src/main/java/de/cweiske/ouya/plainpurchases/PlainPurchases.java

index 324f882..6c453eb 100644 (file)
@@ -31,9 +31,19 @@ public class PlainPurchases implements IXposedHookLoadPackage
                 byte[] input = (byte[]) param.args[0];
 
                 //XposedBridge.log("input: " + new String(input));
-                //XposedBridge.log("returning unencrypted input");
                 //XposedBridge.log(new Exception("doFinal stack trace"));
-                param.setResult(input);
+
+                boolean isJson = input.length > 0
+                    && input[0] == 123// "{"
+                    && input[input.length - 1] == 125;// "}"
+                boolean isDummyKey = input.length == 16
+                    && (new String(input)).equals("0123456789abcdef");
+
+                //only prevent some data from being encrypted/decrypted
+                if (isJson || isDummyKey) {
+                    //XposedBridge.log("returning unencrypted input");
+                    param.setResult(input);
+                }
             }
         });
     }