沙箱 api curl (5) SSL 连接错误

Sandbox api curl (5) SSL connect error

我已经通过 Laravel 为我们的网站完成了 omnipay-paypal 实施。最近我无法使用我的任何沙盒帐户进行测试。我一直收到 SSL 连接错误。 NSS 错误 -12286。有人遇到这个问题吗?我检查了 PayPal 支持,他们已将 SSL 问题标记为已于 2016 年 1 月 19 日解决。

下面是对 api.sandbox.paypal.com 的 cli curl 调用和相应的错误。 有人遇到同样的问题吗?

curl -v https://api.sandbox.paypal.com/v1/oauth2/token \
> -H "Accept: application/json" \
> -H "Accept-Language: en_US" \
> -u "xxx:xxxx" \
> -d "grant_type=client_credentials"
* About to connect() to api.sandbox.paypal.com port 443 (#0)
*   Trying 173.0.82.78... connected
* Connected to api.sandbox.paypal.com (173.0.82.78) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* NSS error -12286
* Closing connection #0
* SSL connect error
curl: (35) SSL connect error

PayPal 更新了它的沙箱环境以仅允许 TLS 1.2 连接以提高安全性并为未来的 PCI 合规性做好准备。您可以在 PayPal 2016 Merchant Security Roadmap Microsite.

上找到有关更新的更多信息

如果您使用任何 PayPal SDK,您可以查看 PayPal TLS Update repository 以了解有关您可能需要哪些 SDK 或环境升级的信息。请注意,命令行上的 运行(例如 PHP CLI)与您的应用程序托管环境(例如 Apache 中的 PHP 模块)之间可能存在环境差异,因此请务必更新所有相关环境。

您需要将 --tlsv1.2 开关添加到某些版本的 curl

更高版本(例如 7.35.0)将自动正确地自动协商 TLS 1.2。如果提供此开关,某些版本(例如 7.19.7)将工作,尽管 man curl 报告说它是后来添加的:

--tlsv1.2 (SSL) Forces curl to use TLS version 1.2 when negotiating with a remote TLS server. (Added in 7.34.0)