cURL error 58: SSL: Can't load the certificate "/path" and its private key: OSStatus -25299 (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
mac 下 curl 使用 pem 證書時發(fā)生的問題榨呆。原因是 iOS/macOS 的默認 SSL 實現(xiàn) Secure Transport 在指定證書字符串時只允許使用系統(tǒng)或用戶鑰匙串(Keychain)中的名稱或 PKCS#12 編碼的證書和密鑰。
另外亥鬓,如果使用的是當(dāng)前目錄下的文件最好使用“./”前綴歌逢,避免與鑰匙串中的別名沖突洗搂。
如何查看自己在使用的 curl 的情況呢褐鸥,使用 curl --version:
# curl with SecureTransport
$ curl --version
curl 7.51.0 (x86_64-apple-darwin16.0) libcurl/7.51.0 SecureTransport zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets
# curl with OpenSSL
curl 7.53.1 (x86_64-apple-darwin16.4.0) libcurl/7.53.1 OpenSSL/1.0.2k zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy
$ brew unlink curl
$ brew install curl --with-openssl
$ brew link curl --force
# 記得在環(huán)境變量 PATH 中將 /usr/local/bin 放于 /usr/bin 之前
$ which curl
/usr/local/bin/curl
https://github.com/curl/curl/issues/283
PHP curl SSLRead() error
php -i | grep "SSL Version" ==> SSL Version => SecureTransport
brew install php@7.2 --with-curl-openssl