Can't verify openssl public key

柔情痞子 提交于 2019-12-10 18:32:58

问题


I'm trying to use openssl_verify() to verify $payload with $publicKey. Here's my code:

$publicKey = openssl_pkey_get_public($_POST['publicKeyURL']);
$playerID = $_POST['playerID'];
$timestamp = intval($_POST['timestamp']);
$signature = base64_decode($_POST['signature']);
$salt = base64_decode($_POST['salt']);

$payload = $playerID . $bundleID . $timestamp . $salt;

$status = openssl_verify($payload, $signature, $publicKey);
openssl_free_key($publicKey);

if ($status == 1) { /* */ }

I'm getting the following error:

openssl_verify() supplied key param cannot be coerced into a public key

The POST information is coming from an iOS app using this Game Center method.

来源:https://stackoverflow.com/questions/22938042/cant-verify-openssl-public-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!