transfer
This commit is contained in:
parent
2296e07192
commit
af9dc72323
@ -134,8 +134,8 @@ class WechatPayService
|
|||||||
{
|
{
|
||||||
// 检查必要头是否存在
|
// 检查必要头是否存在
|
||||||
if (
|
if (
|
||||||
empty($headers['timestamp']) || empty($headers['nonce']) ||
|
empty($headers['wechatpay-timestamp']) || empty($headers['wechatpay-nonce']) ||
|
||||||
empty($headers['signature']) || empty($headers['serial'])
|
empty($headers['wechatpay-signature']) || empty($headers['wechatpay-serial'])
|
||||||
) {
|
) {
|
||||||
Log::error('请求头参数确实');
|
Log::error('请求头参数确实');
|
||||||
return false;
|
return false;
|
||||||
@ -148,8 +148,8 @@ class WechatPayService
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 构造验签名串:timestamp + \n + nonce + \n + body + \n
|
// 构造验签名串:timestamp + \n + nonce + \n + body + \n
|
||||||
$signStr = $headers['timestamp'] . "\n"
|
$signStr = $headers['wechatpay-timestamp'] . "\n"
|
||||||
. $headers['nonce'] . "\n"
|
. $headers['wechatpay-nonce'] . "\n"
|
||||||
. json_encode($body) . "\n";
|
. json_encode($body) . "\n";
|
||||||
|
|
||||||
// 加载微信支付平台公钥
|
// 加载微信支付平台公钥
|
||||||
@ -160,7 +160,7 @@ class WechatPayService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Base64 解码签名
|
// Base64 解码签名
|
||||||
$signature = base64_decode($headers['signature']);
|
$signature = base64_decode($headers['wechatpay-signature']);
|
||||||
|
|
||||||
// 验证签名
|
// 验证签名
|
||||||
$result = openssl_verify($signStr, $signature, $publicKey, OPENSSL_ALGO_SHA256);
|
$result = openssl_verify($signStr, $signature, $publicKey, OPENSSL_ALGO_SHA256);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user