Yevgeniy Afanasyev
Yevgeniy Afanasyev

Reputation: 41410

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

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.

Upvotes: 4

Views: 10863

Answers (1)

pHiL
pHiL

Reputation: 1899

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

Upvotes: 1

Related Questions