List of usage examples for android.support.v4 BuildConfig BUILD_TYPE
String BUILD_TYPE
To view the source code for android.support.v4 BuildConfig BUILD_TYPE.
Click Source Link
From source file:mobi.tattu.utils.billing.Security.java
/** * Verifies that the data was signed with the given signature, and returns * the verified purchase. The data is in JSON format and signed * with a private key. The data also contains the {@link PurchaseState} * and product ID of the purchase.// www. j av a 2 s .c o m * @param base64PublicKey the base64-encoded public key to use for verifying. * @param signedData the signed JSON string (signed, not encrypted) * @param signature the signature for the data, signed with the private key */ public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) { if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) { //TODO esta linea se tiene que sacar al generar la apk, para produccion? if (BuildConfig.BUILD_TYPE.equals("release")) { return true; } Log.e(TAG, "Purchase verification failed: missing data."); return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); }