Commit e08bb392 by Administrator

Merge branch 'dev_huishouqian' into 'master'

优化代付通道解密方法

See merge request !10
2 parents 523a47b3 f2fea08c
...@@ -51,7 +51,14 @@ class HsqTransferNotify extends NotifyStrategy ...@@ -51,7 +51,14 @@ class HsqTransferNotify extends NotifyStrategy
$tmp2 = explode("=",$val); $tmp2 = explode("=",$val);
$result_data[$tmp2[0]] = $tmp2[1]; $result_data[$tmp2[0]] = $tmp2[1];
} }
return $result_data; if (empty($this->config->publicKey)) return false;
$publicKey = $this->config->publicKey;
$retData = $result_data['data_content'];
//解密
$decrypt = BaoFooRsaUtil::decryptByCERFile($retData, $publicKey);
$data_content = DataParser::toArray($decrypt);
$result = $data_content['trans_reqDatas']['trans_reqData'] ?? '';
return $result;
} }
/** /**
...@@ -75,22 +82,7 @@ class HsqTransferNotify extends NotifyStrategy ...@@ -75,22 +82,7 @@ class HsqTransferNotify extends NotifyStrategy
*/ */
protected function verifySign(array $retData) protected function verifySign(array $retData)
{ {
if (empty($this->config->publicKey)) return false; return true;
$publicKey = $this->config->publicKey;
$retData = $retData['data_content'];
//解密
$decrypt = BaoFooRsaUtil::decryptByCERFile($retData, $publicKey);
$data_content = DataParser::toArray($decrypt);
$result = $data_content['trans_reqDatas']['trans_reqData'] ?? '';
if($result)
{
//验签成功
return $result;
}
else{
return false;
}
} }
/** /**
......
...@@ -52,6 +52,7 @@ abstract class NotifyStrategy ...@@ -52,6 +52,7 @@ abstract class NotifyStrategy
// 回调商户的业务逻辑 // 回调商户的业务逻辑
$flag = $this->callback($notify, $notifyData); $flag = $this->callback($notify, $notifyData);
if ($flag) { if ($flag) {
$msg = 'OK'; $msg = 'OK';
} else { } else {
...@@ -115,4 +116,4 @@ abstract class NotifyStrategy ...@@ -115,4 +116,4 @@ abstract class NotifyStrategy
* *
*/ */
abstract protected function replyNotify($flag, $msg = 'OK'); abstract protected function replyNotify($flag, $msg = 'OK');
} }
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!