简体   繁体   English

带有ssl证书的付款服务器cUrl http发布要求输入我没有的私钥

[英]payment server cUrl http post with ssl certificate asks for private key I don't have

I've got to send data to payment server and receive result from it. 我必须将数据发送到支付服务器并从中接收结果。 I've decided to use cUrl to accomplish that. 我决定使用cUrl来实现这一目标。 The other party gave me a ssl certificate, which acts like public key (if I understand it correctly). 另一方给了我ssl证书,该证书的作用类似于公钥(如果我正确理解的话)。 cUrl call returns error complaining about inability to set private key, which I don't understand, because I can't get payment server's private key for security issues. cUrl调用返回错误,抱怨无法设置私钥,这是我不了解的,因为我无法获得支付服务器的私钥来解决安全问题。 I just need to pass my ssl certificate to payment server so that they can identify me (they have my server IP and I suppose private key for certificate they gave me). 我只需要将我的ssl证书传递给支付服务器,以便他们可以识别我(他们拥有我的服务器IP,我想他们给我的证书的私钥)。

I suppose I need to simulate the way browser is sending it's certificate to access necessary website, not signing information with private key. 我想我需要模拟浏览器发送其证书以访问必要网站的方式,而不是使用私钥对信息进行签名。

So the question is - how to make the cUrl http post? 因此,问题是-如何制作cUrl http帖子?

Right now I use this code: 现在,我使用以下代码:

$x = curl_init();
$options = array(
    CURLOPT_URL => $serverURL,
    CURLOPT_VERBOSE => 1, 
    CURLOPT_SSLCERT => getcwd() . "/certificate.pem",
    CURLOPT_SSL_VERIFYPEER => false, 
    CURLOPT_SSL_VERIFYHOST => 2,
    CURLOPT_FAILONERROR => 1, 
    CURLOPT_HEADER => true,
    CURLOPT_POST => 1,
    CURLOPT_POSTFIELDS => $string,
    CURLOPT_FOLLOWLOCATION => 0,
    CURLOPT_RETURNTRANSFER => 1, 
    CURLOPT_TIMEOUT => 5,
);

curl_setopt_array($x, $options);

$data = curl_exec($x);


if (curl_errno($x)) {
    echo curl_error($x) . " ( " . curl_errno($x) . " )<br/>"; 
} else {
    echo "reponse: ";
    var_dump ($data);
}

CURLOPT_SSL_VERIFYPEER应该设置为true而不是false

Ok. 好。 It seems that I was not given all the data. 似乎我没有得到所有数据。 I must have had a key and keypass to function properly. 我必须拥有一个密钥和密钥密码才能正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM