caipivara
9/19/2014 - 1:05 AM

Replace the verifyPurchase method on "util/Security.java" for android In-App purchases in tests in order to make it pass the invalid sign ve

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

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);
}
public class AppConfig {
    public static final boolean DEBUG = true;
}