亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

php - Bank QR code payment access problem
世界只因有你
世界只因有你 2017-05-16 13:02:18
0
1
1053

Recently I am working on the bank’s QR code payment access. After getting the document, there are a few things I don’t understand very well.
1. Downloaded the private key (.sm2) and public key (.cer) of the signed certificate and imported the public key directly. I don’t know how to use the private key certificate
2. Since I am using the PHP demo, PHP The code calls LAJP to call the JAVA environment for signing. The data obtained after signing in the php demo cannot pass the test signature verification. I don’t know which step is wrong
Attached is the test demo on the web page: http://wxpay.cmbc.com.cn/cmbc...< br>Provided local signature function:
<?php

require_once("php_java.php");//Quoting the PHP script provided by LAJP
   try
    {
       $signAlg = $_REQUEST['signAlg'];
       $base64SourceData = $_REQUEST['base64SourceData'];
       $base64P12Data = $_REQUEST['base64P12Data'];
       $p12Password = $_REQUEST['p12Password'];
       $ret = lajp_call("cfca.sadk.api.SignatureKit::P1SignMessage", $signAlg,$base64SourceData, $base64P12Data,$p12Password);
       echo "{$ret}<br>";
    }
catch(Exception $e)
{
  echo "Err:{$e}<br>";
}
?><a href="index.html">return</a>
世界只因有你
世界只因有你

reply all(1)
黃舟
一、第一個(gè)問(wèn)題,帶證書(shū),應(yīng)該使用curl
 /**
     *     作用:使用證書(shū),以post方式提交xml到對(duì)應(yīng)的接口url
     */
    function postXmlSSLCurl($xml, $url, $second = 30, $wxpay_config) {
            $ch = curl_init();
            //超時(shí)時(shí)間
            curl_setopt($ch, CURLOPT_TIMEOUT, $second);
            //這里設(shè)置代理,如果有的話(huà)
            
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
            //設(shè)置header
            curl_setopt($ch, CURLOPT_HEADER, FALSE);
            //要求結(jié)果為字符串且輸出到屏幕上
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
            //設(shè)置證書(shū)
            //使用證書(shū):cert 與 key 分別屬于兩個(gè).pem文件
            //默認(rèn)格式為PEM,可以注釋
            curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');
            curl_setopt($ch, CURLOPT_SSLCERT, $wxpay_config['SSLCERT_PATH']);
            //默認(rèn)格式為PEM,可以注釋
            curl_setopt($ch, CURLOPT_SSLKEYTYPE, 'PEM');
            curl_setopt($ch, CURLOPT_SSLKEY, $wxpay_config['SSLKEY_PATH']);
            //post提交方式
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $xml);
            $data = curl_exec($ch);
            //返回結(jié)果
            if ($data) {
                curl_close($ch);
                return $data;
            } else {
                $error = curl_errno($ch);
                echo "curl出錯(cuò),錯(cuò)誤碼:$error" . "<br>";
                // echo "<a ;
                curl_close($ch);
                return false;
            }
    }

二、簽名的話(huà)
你試著用PHP同樣的參數(shù)自己生產(chǎn)簽名跟java環(huán)境比對(duì)看看。一般來(lái)說(shuō)應(yīng)該是不能共用的吧。之前遇到過(guò)app里面的微信支付通過(guò)php生成的簽名給過(guò)來(lái)app用,這個(gè)之前好像是行不通的。
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template