Does anybody have more information available about server side receipt validation for the Google play store?
I notice a lot of piracy when comparing the flurry analytics and the actual sales
For anyone interested who found this very old topic, like me, while googling
function verify_market_in_app($signed_data, $signature, $public_key_base64)
{
$key = "-----BEGIN PUBLIC KEY-----\n".
chunk_split($public_key_base64, 64,"\n").
'-----END PUBLIC KEY-----';
//using PHP to create an RSA key
$key = openssl_get_publickey($key);
var_dump($key);
//$signature should be in binary format, but it comes as BASE64.
//So, I'll convert it.
$signature = base64_decode($signature);
//using PHP's native support to verify the signature
$result = openssl_verify(
$signed_data,
$signature,
$key,
OPENSSL_ALGO_SHA1);
if (0 === $result)
{
return 0;
}
else if (1 !== $result)
{
return 0;
}
else
{
return 1;
}
}