Skip to content

Instantly share code, notes, and snippets.

@alexoro
Created March 23, 2015 16:56
Show Gist options
  • Save alexoro/44588f1fea1212bca908 to your computer and use it in GitHub Desktop.
Save alexoro/44588f1fea1212bca908 to your computer and use it in GitHub Desktop.
<?php
$key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu5KsJ49lLMGatAhehkOddC3rAEFinRbSPt0tQp+IsKUF1w/IoFjujkiJY5ZuAkS99CdPVndSNvkomOqBp9gEVyojQlugQJEwsOambusTnV8i60dY6JnSncFA+qKdTY565yUVFHoERdfF7wotOyw8Hmuxshpegu+6IIxpOI5FqdkqBDtTRBhnFfYGk0MqQSuz+iheU/pxdUeNVgVCt0O2ExaDv+vqLboPklM7y5V7TDEDY/unuwbPj36C6ktQ7ex02Sz7JxabQig+VQrTcAQVIuq1jukMXDES7VeXjPkCspwMLbHtuUBciynsB2lG2ivNgvVZpPRLUs0Gr7NAb3czZwIDAQAB";
$data = "{\"orderId\":\"12999763169054705758.1332873758230775\",\"packageName\":\"com.nemotelecom.tv\",\"productId\":\"com.nemotelecom.nemotv.testpay\",\"purchaseTime\":1427113405727,\"purchaseState\":0,\"purchaseToken\":\"nckfcfcblglnhpjaehiepdpf.AO-J1Oy7RsMUCDf-RKu2Z8BZIvUqnZjmouMIrPXcPzAUJ_ohD-zedB4VlY4ZubjylTPDMOZymfSayNJue7rn0ccsYkXmZVS3qAvg7usrJS2AGybO64Pmd1fgYmPxbtPUC8wHLy1gDeB1wn0gizb9Nq4CiEplL5uotw\"}";
$sign = "rFHGmt5HE8agwtFroBWEQW4pYWuSppN/X19TBSf8dfadADdTDS2pNtCvUDgdY2/tWv2ymYHZfnMjicyHl7m7JRF/yXH7PhhIj5sNoToWrjrK/DbfA6d+IcIRBHzIYfAm8FmO2JOKd213KWBoce+POmliasNP+l/fVQTzwDjvo6L76THxLlY4e6pwEJf4ctWh1iMZ8clehxPV80x+pPxsEZQA9BHmr3G+uarMXW3li3lW3i7R+HcBS0UfGqaFqDem/+thAVYRWD18fFznW52S3e1o5RIyDeu59GQRUwOOI9voMQQuGKpT6+fUoVE3VKdMAYnzO7O7EUqpUqmGjd9Auw==";
$prefix = "-----BEGIN PUBLIC KEY-----\n";
$suffix = "-----END PUBLIC KEY-----";
$key = $prefix . chunk_split($key, 64, "\n") . $suffix;
$key = openssl_get_publickey($key);
//echo($key ? "Okay" : "Nope :(");
$result = openssl_verify($data, base64_decode($sign), $key, OPENSSL_ALGO_SHA1);
echo ($result ? "Yes" : "No");
echo ("\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment