Example #1
0
function verify($params)
{
    global $log;
    $public_key = getPulbicKeyByCertId($params['certId']);
    $signature_str = $params['signature'];
    unset($params['signature']);
    $params_str = coverParamsToString($params);
    $log->LogInfo('报文去[signature] key=val&串>' . $params_str);
    $signature = base64_decode($signature_str);
    $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;
}
Example #2
0
/**
 * 验签
 *
 * @param String $params_str        	
 * @param String $signature_str        	
 */
function verify($params)
{
    // 公钥
    $public_key = getPulbicKeyByCertId($params['certId']);
    //	echo $public_key.'<br/>';
    // 签名串
    $signature_str = $params['signature'];
    unset($params['signature']);
    $params_str = coverParamsToString($params);
    $signature = base64_decode($signature_str);
    //	echo date('Y-m-d',time());
    $params_sha1x16 = sha1($params_str, FALSE);
    $isSuccess = openssl_verify($params_sha1x16, $signature, $public_key, OPENSSL_ALGO_SHA1);
    return $isSuccess;
}
Example #3
0
 /**
  * 验签
  *
  * @param String $params_str
  * @param String $signature_str
  */
 public function verify($params)
 {
     // 公钥
     $public_key = $this->getPulbicKeyByCertId($params['certId']);
     //	echo $public_key.'<br/>';
     // 签名串
     $signature_str = $params['signature'];
     unset($params['signature']);
     $params_str = coverParamsToString($params);
     $this->log->LogInfo('报文去[signature] key=val&串>' . $params_str);
     $signature = base64_decode($signature_str);
     //	echo date('Y-m-d',time());
     $params_sha1x16 = sha1($params_str, FALSE);
     $this->log->LogInfo('摘要shax16>' . $params_sha1x16);
     $isSuccess = openssl_verify($params_sha1x16, $signature, $public_key, OPENSSL_ALGO_SHA1);
     $this->log->LogInfo($isSuccess ? '验签成功' : '验签失败');
     return $isSuccess;
 }
Example #4
0
/**
 * 验签
 *
 * @param String $params_str        	
 * @param String $signature_str        	
 */
function verify($params)
{
    $log = new PhpLog(SDK_LOG_FILE_PATH, "PRC", SDK_LOG_LEVEL);
    $log->LogInfo('=====POST的内容======');
    $log->LogInfo(var_export($params, true));
    // 公钥
    $public_key = getPulbicKeyByCertId($params['certId']);
    //	echo $public_key.'<br/>';
    // 签名串
    $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;
}