<?php
// get data param
$data = $_GET['response_data'];

// get signature param
$signature = $_GET['sig'];

$data = str_replace(" ","+",$data);

$signature = str_replace(" ","+",$signature);

// get key
$key_64 = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhNHdmXm56sQSk13qjp9rTJevCewnZ1KrqoedOcYHkvO7rj98Ma7MQtwV90uzZLklY+1VdktR8d0t3D65mJPXig02NyrF0mTbT2FgfKFkq5Xl1PnFiImUsf4IYLc1z2gj4N91Ezx9umiYrn0hRwagb9pW/CpcRZmG7FS9mgAeQAvynGsWEL+RjtY+Yq5FEmkjxorAddtnK5Sua3B6Np8yt72Q7BKAU7Ms2zw2fqIqNywR560VA1BMRPym4RbSohI8XHMk7KfSIkkein7KQr++hD9Kk5W3Gh5V2kP4t4kj6kKF+7v1OOmeQmZammPDVsct6wpwJgaevuPtavVZYbfKkwIDAQAB";



$key =  "-----BEGIN PUBLIC KEY-----\n".
        chunk_split($key_64, 64,"\n").
       '-----END PUBLIC KEY-----';   
//using PHP to create an RSA key
$key = openssl_get_publickey($key);


// state whether signature is okay or not
$ok = openssl_verify($data, base64_decode($signature), $key, OPENSSL_ALGO_SHA1);
if ($ok == 1) {
    echo "good";
} elseif ($ok == 0) {
    echo "bad";
} else {
    die ("fault, error checking signature");
}

// free the key from memory
openssl_free_key($key);

?>