dtdfj08626 2018-08-31 14:42 采纳率: 0%
浏览 81
已采纳

PHP卷曲 - 发送证书的正确方法?

Im using a webservice that requires autentication it one cliente certificate sended by curl. I already have the certificate (.pem), the public key and the private key (.pem) extracted from a .pfx file.

Im sending then like this:

    curl_setopt($ch, CURLOPT_SSLCERT, '_cert.pem');
    curl_setopt($ch, CURLOPT_SSLKEY, '_priKEY.pem');
    curl_setopt($ch, CURLOPT_SSLCERTTYPE, 'PEM');
    curl_setopt($ch, CURLOPT_KEYPASSWD, '****');

But the WS always return the message that i need to send the cliente certificate. Whats is the correct way to send?

Other questions: Did i not need to send the public key file? and "keypasswd" is realy necessary?

  • 写回答

1条回答 默认 最新

  • dongyun6835 2018-10-02 15:17
    关注

    I was using "HTTP", and to send the certificate on the request, i need to use "HTTPS".

    Don't need to use "CURLOPT_SSLCERTTYPE" option when the format is .pem, because the .pem is already the default format. The "public key", usualy, do not need to be sent, only the private key (when the certificate has one).

    The "CURLOPT_KEYPASSWD" need to be used when the private key have some passphrase, other wise, don't use it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?