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

4

这段代码在Ubuntu vagrant box上运行良好,但在本地的MacOs上加载证书时并没有成功。

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

但这并没有解决问题。

请告诉我我做错了什么。

谢谢。


与错误 https://github.com/curl/curl/issues/283 相关 - user2707671
1个回答

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

你能指出在哪里设置这些路径吗?我不理解在哪里以及要做什么的主题... - novski
要永久设置PATH变量,请将其添加到您的shell rc文件中。这可能是~/.zshrc或更标准/可能的是~/.bashrc。 如果您需要在某个软件项目中使用openssl,您必须在构建工具中设置LDFLAGS CPPFLAGS和可能的PKG_CONFIG_PATH。否则请忽略它们。 - pHiL

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接