curl - TLS 1.2 升级后 PayPal 沙箱 API SSL 错误 errno 54

标签 curl paypal paypal-sandbox tls1.2

不确定这是否是最好的询问地点,但在 2017 年 6 月 30 日 PayPal 进行 TLS 1.2 升级后,我无法使用他们的沙盒 NVP 端点:https://api-3t。 sandbox.paypal.com/nvp

实时 API https://api-3t.paypal.com/nvp 按预期工作:

~ % curl "https://api-3t.paypal.com/nvp?user=whatever"
ACK=Failure&L_ERRORCODE0=81002&L_SHORTMESSAGE0=Unspecified%20Method&L_LONGMESSAGE0=Method%20Specified%20is%20not%20Supported&L_SEVERITYCODE0=Error

我从服务器得到一个响应正文。

但是如果我用沙箱尝试相同的请求,我会得到:

~ % curl "https://api-3t.sandbox.paypal.com/nvp?user=whatever"
curl: (56) OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54

我已经尝试了几种强制 TLS 1.2 和不安全连接的组合,但它们没有任何区别。这是一个详细的输出:

~ % curl --insecure --tlsv1.2 -v "https://api-3t.sandbox.paypal.com/nvp?user=whatever"
*   Trying 173.0.82.83...
* TCP_NODELAY set
* Connected to api-3t.sandbox.paypal.com (173.0.82.83) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /opt/local/share/curl/curl-ca-bundle.crt
  CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / AES256-SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=US; ST=California; L=San Jose; O=PayPal, Inc.; OU=PayPal Production; CN=api-3t.sandbox.paypal.com
*  start date: Jan 14 00:00:00 2016 GMT
*  expire date: Jan 14 23:59:59 2018 GMT
*  issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4
*  SSL certificate verify ok.
> GET /nvp?user=whatever HTTP/1.1
> Host: api-3t.sandbox.paypal.com
> User-Agent: curl/7.54.1
> Accept: */*
>
* OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
* Closing connection 0
curl: (56) OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54

我在 macOS 上并尝试使用 MacPorts 升级 OpenSSL 和 cURL,我在 php70-curl 中得到了相同的行为,它也是最新的 OpenSSL 1.0.2l。在使用 OpenSSL 1.0.2k 的 FreeBSD 机器上快速检查后也有同样的行为:

* SSL read: error:00000000:lib(0):func(0):reason(0), errno 54
* Curl_http_done: called premature == 1
* stopped the pause stream!
* Closing connection 0
curl: (56) SSL read: error:00000000:lib(0):func(0):reason(0), errno 54

非常感谢任何帮助

最佳答案

https://www.paypal.com/au/webapps/mpp/merchant-security-roadmap 中所述,已通过使用 POST 而不是 GET 进行了修复 和 https://www.paypal.com/au/webapps/mpp/discontinuation-get-method

还必须将我的 POST 数据作为 application/x-www-form-urlencoded

传递

关于curl - TLS 1.2 升级后 PayPal 沙箱 API SSL 错误 errno 54,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45341025/

相关文章:

php - paypal php sdk 设置定期付款

c++ - 安装 cURL 后 undefined reference

asp.net - Paypal与asp.net、C#.net电子商务网站集成

curl - Google Apps 脚本 cUrl 请求

javascript - 在单击 Paypal 按钮提交表单之前执行 javascript

.net - Paypal REST API .net SDK - 400 个错误请求

android - paypal android SDK 与我的应用程序集成无法正常工作

php - PayPal支付执行错误: Method type not supported for this operation

php - 似乎无法通过 cURL 获取网页内容 - 用户代理和 HTTP header 都已设置?

curl - 使用 openssl 和 curl 验证服务器证书