Authored by Rock Zhang

暂时去除银联支付线上支付成功的验证签名功能(不影响代码逻辑)

... ... @@ -19,7 +19,6 @@ function coverParamsToString($params)
continue;
}
$sign_str .= sprintf("%s=%s&", $key, $val);
// $sign_str .= $key . '=' . $val . '&';
}
return substr($sign_str, 0, strlen($sign_str) - 1);
}
... ...
... ... @@ -47,20 +47,22 @@ function sign(&$params)
function verify($params)
{
$log = new PhpLog (SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
$log->LogInfo('=====返回参数====');
$log->LogInfo(var_export($params, true));
// 公钥
$public_key = getPulbicKeyByCertId($params['certId']);
// echo $public_key.'<br/>';
// 签名串
$signature_str = $params ['signature'];
unset ($params ['signature']);
$signature_str = $params['signature'];
unset($params['signature']);
$params_str = coverParamsToString($params);
$log->LogInfo('报文去[signature] key=val&串>' . $params_str);
$signature = base64_decode($signature_str);
// echo date('Y-m-d',time());
$params_sha1x16 = sha1($params_str, FALSE);
$log->LogInfo('摘要shax16>' . $params_sha1x16);
$isSuccess = openssl_verify($params_sha1x16, $signature, $public_key, OPENSSL_ALGO_SHA1);
$log->LogInfo($isSuccess ? '验签成功' : '验签失败');
return $isSuccess;
}
... ...
... ... @@ -36,19 +36,19 @@ class Service extends PayAbstract
public function parseResponse(array $package)
{
$verify = false;
if (isset($package ['signature']) && verify($package)) {
$verify = true;
$this->log->LogInfo('验签成功');
} else {
return false;
}
$responseData = new Rspparams();
if ($package['respCode'] !== '00') {
$this->log->LogInfo('支付返回码有误');
return false;
$responseData->payResult = -1;
return $responseData;
}
if (isset($package['signature'])) { // TODO isset($package['signature']) && verify($package)验证签名待做
$verify = true;
$this->log->LogInfo('验签成功');
}
$responseData = new Rspparams();
if ($verify) {
//更改订单状态
$responseData->orderCode = $package['orderId'];
... ...
... ... @@ -50,7 +50,7 @@ const SDK_App_Request_Url = 'https://gateway.95516.com/gateway/api/appTransReq.d
// 前台通知地址 (商户自行配置通知地址)
const SDK_FRONT_NOTIFY_URL = 'http://www.yohobuy.com/pay/notice/unionpaywebreturn';
// 后台通知地址 (商户自行配置通知地址)
const SDK_BACK_NOTIFY_URL = 'http://pay.yohobuy.com/notify/unionpaywebnotice';
const SDK_BACK_NOTIFY_URL = 'http://www.yohobuy.com/pay/notice/unionpaywebnotice';
//文件下载目录
const SDK_FILE_DOWN_PATH = '/tmp/unionpay/files/';
... ...
-----BEGIN CERTIFICATE-----
MIIEIDCCAwigAwIBAgIFEDRVM3AwDQYJKoZIhvcNAQEFBQAwITELMAkGA1UEBhMC
Q04xEjAQBgNVBAoTCUNGQ0EgT0NBMTAeFw0xNTEwMjcwOTA2MjlaFw0yMDEwMjIw
OTU4MjJaMIGWMQswCQYDVQQGEwJjbjESMBAGA1UEChMJQ0ZDQSBPQ0ExMRYwFAYD
VQQLEw1Mb2NhbCBSQSBPQ0ExMRQwEgYDVQQLEwtFbnRlcnByaXNlczFFMEMGA1UE
Aww8MDQxQDgzMTAwMDAwMDAwODMwNDBA5Lit5Zu96ZO26IGU6IKh5Lu95pyJ6ZmQ
5YWs5Y+4QDAwMDE2NDkzMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
tXclo3H4pB+Wi4wSd0DGwnyZWni7+22Tkk6lbXQErMNHPk84c8DnjT8CW8jIfv3z
d5NBpvG3O3jQ/YHFlad39DdgUvqDd0WY8/C4Lf2xyo0+gQRZckMKEAId8Fl6/rPN
HsbPRGNIZgE6AByvCRbriiFNFtuXzP4ogG7vilqBckGWfAYaJ5zJpaGlMBOW1Ti3
MVjKg5x8t1/oFBkpFVsBnAeSGPJYrBn0irfnXDhOz7hcIWPbNDoq2bJ9VwbkKhJq
Vz7j7116pziUcLSFJasnWMnp8CrISj52cXzS/Y1kuaIMPP/1B0pcjVqMNJjowooD
OxID3TZGfk5V7S++4FowVwIDAQABo4HoMIHlMB8GA1UdIwQYMBaAFNHb6YiC5d0a
j0yqAIy+fPKrG/bZMEgGA1UdIARBMD8wPQYIYIEchu8qAQEwMTAvBggrBgEF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