cURL error 58: SSL: Can't load the certificate “…” and its private key: OSStatus -25299 on Mac

别等时光非礼了梦想. 提交于 2019-11-30 18:59:31

问题


The code is working fine on Ubuntu vagrant box, but on local MacOs it does not load sertificates saying

cURL error 58: SSL: Can't load the certificate "..." and its private key: OSStatus -25299

I researched that Mac has a point of supporting the OS X native API instead of OpenSSL.

And I need to convert a pem + cert to pkcs12 like that.

openssl pkcs12 -export -in ./client.crt -inkey ./client.pem -out client.p12

But this is not working for me because my PHP server is on Ubuntu and I don't want to break what is working. My task is to make it work on Mac.

I would rather install curl with openssl support. I tried this:

$ brew uninstall curl
$ brew install curl --with-openssl
$ brew link curl --force
$ curl --version

But it did not solve the problem.

Please tell me what am I did wrong.

Thank you.


回答1:


installing curl via brew and with openssl support as outlined in the question is the correct approach. however you need to explicitly call it from its install dir /usr/local/opt/curl/bin/curl -v -k --key.. as brew wont link it to /usr/local as stated on install

This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/curl/bin:$PATH"' >> ~/.zshrc

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/curl/lib
    CPPFLAGS: -I/usr/local/opt/curl/include
For pkg-config to find this software you may need to set:
    PKG_CONFIG_PATH: /usr/local/opt/curl/lib/pkgconfig


来源:https://stackoverflow.com/questions/40712352/curl-error-58-ssl-cant-load-the-certificate-and-its-private-key-osstat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!