cURL错误58:SSL:无法加载证书" ..."及其私钥:Mac上的OSStatus -25299

时间:2016-11-21 03:33:32

标签: php macos curl homebrew commoncrypto

代码在Ubuntu vagrant box上工作正常,但在本地MacO上它没有加载sertificates说

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

我研究过Mac有一点支持OS X本机API而不是OpenSSL。

我需要将 pem + cert 转换为 pkcs12

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

但是这对我不起作用,因为我的PHP服务器在Ubuntu上而且我不想破坏正常工作。我的任务是让它在Mac上运行。

我宁愿用openssl支持安装curl。我试过这个:

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

但它没有解决问题。

请告诉我我做错了什么。

谢谢。

1 个答案:

答案 0 :(得分:1)

通过brew安装curl和问题中概述的openssl支持是正确的方法。但是你需要从它的安装目录/usr/local/opt/curl/bin/curl -v -k --key..明确地调用它,因为brew不会将它链接到/ usr / local,如安装中所述

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