Created
September 19, 2014 01:05
-
-
Save danielgomezrico/ec95c991cf25911d4ec3 to your computer and use it in GitHub Desktop.
Replace the verifyPurchase method on "util/Security.java" for android In-App purchases in tests in order to make it pass the invalid sign verification. src=http://stackoverflow.com/a/19539213/273119
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AppConfig { | |
public static final boolean DEBUG = true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean verifyPurchase(String base64PublicKey, | |
String signedData, String signature) { | |
if (signedData == null) { | |
Log.e(TAG, "data is null"); | |
return false; | |
} | |
if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) | |
|| TextUtils.isEmpty(signature)) { | |
Log.e(TAG, "Purchase verification failed: missing data."); | |
if (BuildConfig.DEBUG) { | |
Log.d("DeBUG", ">>>"+BuildConfig.DEBUG); | |
return true; | |
} | |
return false; | |
} | |
PublicKey key = Security.generatePublicKey(base64PublicKey); | |
return Security.verify(key, signedData, signature); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment