示例#1
0
 /**
  * 生成签名结果
  * @param $para_sort 已排序要签名的数组
  * return 签名结果字符串
  */
 function buildRequestMysign($para_sort)
 {
     //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
     $prestr = AlipayCore::createLinkstring($para_sort);
     $mysign = "";
     switch (strtoupper(trim($this->alipay_config['sign_type']))) {
         case "MD5":
             $mysign = AlipayMd5::md5Sign($prestr, $this->alipay_config['key']);
             break;
         default:
             $mysign = "";
     }
     return $mysign;
 }
示例#2
0
 /**
  * 获取返回时的签名验证结果
  * @param $para_temp 通知返回来的参数数组
  * @param $sign 返回的签名结果
  * @return 签名验证结果
  */
 function getSignVeryfy($para_temp, $sign)
 {
     //除去待签名参数数组中的空值和签名参数
     $para_filter = AlipayCore::paraFilter($para_temp);
     //对待签名参数数组排序
     $para_sort = AlipayCore::argSort($para_filter);
     //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
     $prestr = AlipayCore::createLinkstring($para_sort);
     $isSgin = false;
     switch (strtoupper(trim($this->alipay_config['sign_type']))) {
         case "MD5":
             $isSgin = AlipayMd5::md5Verify($prestr, $sign, $this->alipay_config['key']);
             break;
         default:
             $isSgin = false;
     }
     return $isSgin;
 }