public static boolean verifyPurchase(String productId,String base64PublicKey,String signedData,String signature){
  if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) {
    if (BuildConfig.DEBUG) {
      if (productId.equals("android.test.purchased")) {
        return true;
      }
    }
    Log.e(TAG,"Purchase verification failed: missing data.");
    return false;
  }
  PublicKey key=Security.generatePublicKey(base64PublicKey);
  return Security.verify(key,signedData,signature);
}

public static boolean verifyPurchase ( String productId , String base64PublicKey , String signedData , String signature ) { if ( TextUtils . isEmpty ( signedData ) || TextUtils . isEmpty ( base64PublicKey ) || TextUtils . isEmpty ( signature ) ) { if ( BuildConfig . DEBUG ) { if ( productId . equals ( "android.test.purchased" ) ) { return true ; } } Log . e ( TAG , "Purchase verification failed: missing data." ) ; return false ; } PublicKey key = Security . generatePublicKey ( base64PublicKey ) ; return Security . verify ( key , signedData , signature ) ; }
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 .
