Skip to content Skip to sidebar Skip to footer

Php Server Side Iab Verification Openssl_verify Always Returns 0

I'm using the following function (server side php) to verify a IAB v3 transaction: I'm passing from the android app: @Override protected void onActivityResult(int requestCode,

Solution 1:

In my experience openssl_get_publickey() only creates public key resources when you have a public key in an X.509 cert.

My recommendation would be to use phpseclib, a pure PHP RSA implementation. eg.

functionverify_play($signed_data, $signature) 
{
  global$public_key_base64;
  $rsa = new Crypt_RSA();
  $rsa->loadKey($public_key_base64);
  $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
  $signature = base64_decode($signature);   
  return$rsa->verify($signed_data, $signature);
}

Post a Comment for "Php Server Side Iab Verification Openssl_verify Always Returns 0"