开发者

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. The other party gave me a ssl certificate, which acts like public key (if I understand it corr开发者_JAVA技巧ectly). 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. 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).

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?

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 should be set to true not false


Ok. It seems that I was not given all the data. I must have had a key and keypass to function properly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜