cURL with SSL certificates fails: error 58 unable to set private key file

后端 未结 2 1930
天命终不由人
天命终不由人 2020-12-17 18:13

I\'m trying to connect to a remote host using cURL. The connection requires the use of a certificate and a private key which is password protected. So far I\'m unsuccessful

相关标签:
2条回答
  • 2020-12-17 18:23

    Just in case this is useful to others searching for this problem, I ended up discovering that CURLOPT_SSLCERT and CURLOPT_SSLKEY don't seem to work with relative paths.

    This is with WAMP, php version 5.5 on Windows.

    0 讨论(0)
  • 2020-12-17 18:27

    I've fixed this problem. I think, due to the number of questions regarding this issue and number of different solutions, others will benefit from the solution. Here goes:

    I used the openssl CLI program to convert the .p12 key-file to a .pem key-file. The trick is the way the conversion takes place.

    First I converted it with this command and I had the issue as described in the question:

    openssl pkcs12 -in key.p12 -out key.pem -nodes -clcerts

    While the command below did the actual trick:

    openssl pkcs12 -in key.p12 -out key.pem -clcerts

    For more info please see the source I used: https://community.qualys.com/docs/DOC-3273

    0 讨论(0)
提交回复
热议问题