【问题标题】:Symfony2 & PayPal - cURL error:14077410:SSL (sslv3 alert handshake failure)Symfony2 和 PayPal - cURL 错误:14077410:SSL(sslv3 警报握手失败)
【发布时间】:2016-05-09 03:27:49
【问题描述】:

我正在尝试连接到 Paypal 的沙盒服务器。为此,我使用了 JMSPaymentCoreBundle 和 JMSPaypalCoreBundle。

但是当我尝试连接时抛出异常:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

我的 Symfony 版本是 2.7.9。我的 curl 版本是 7.43.0,OpenSSL 版本是 1.0.2f。

我在互联网上寻找答案,现在 cURL 请求使用 TLS 1.2 以使用 PayPal 沙箱。所以我补充说: curl_setopt($curl, CURLOPT_SSLVERSION,6);(这是 TLS 1.2) 在vendor/jms/payment-paypal-bundle/JMS/Payment/PaypalBundle/Client/Client.php

但现在我收到以下错误:cURL Error: Unsupported SSL protocol version

感谢您的帮助! (对不起我的英语)

编辑:所以错误似乎来自以下部分

在我的控制器中:

$instruction = $reservation->getPaymentInstruction();
if (null === $pendingTransaction = $instruction->getPendingTransaction()) {
    $payment = $this->ppc->createPayment($instruction->getId(), $instruction->getAmount() - $instruction->getDepositedAmount());
} else {
    $payment = $pendingTransaction->getPayment();
}

$result = $this->ppc->approveAndDeposit($payment->getId(), $payment->getTargetAmount());
if (Result::STATUS_PENDING === $result->getStatus()) {
    $ex = $result->getPluginException();

    if ($ex instanceof ActionRequiredException) {
          $action = $ex->getAction();

          if ($action instanceof VisitUrl) {
              return $this->redirect($action->getUrl());
          }

          throw $ex;
      }
} else if (Result::STATUS_SUCCESS !== $result->getStatus()) {
    throw new \RuntimeException('Transaction was not successful: '.$result->getReasonCode());
}

在我的供应商中:(vendor/jms/payment-paypal-bundle/JMS/Payment/PaypalBundle/Client/Client.php)

public function request(Request $request)
{
    if (!extension_loaded('curl')) {
        throw new \RuntimeException('The cURL extension must be loaded.');
    }

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt_array($curl, $this->curlOptions);
    curl_setopt($curl, CURLOPT_URL, $request->getUri());
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_HEADER, true);
// Try but did not worl: curl_setopt($curl, CURLOPT_SSL_CIPHER_LIST,     'TLSv1');
    curl_setopt($curl, CURLOPT_SSLVERSION,6); // What i also add but error with my SSL protocol version not supported

etc.

当我在 Client.php 中添加curl_setopt($curl, CURLOPT_SSLVERSION,6); I'v got that

并且 when I don't

【问题讨论】:

  • 您能否发布您在代码中遇到问题的位置?

标签: php symfony ssl curl paypal


【解决方案1】:

您是否正在针对 PayPal 沙盒 API 端点进行测试? PayPal 昨晚升级了他们的 Sandbox API 端点,要求使用 TLS 1.2 并(仅)提供 SHA256 签名的证书。

更多细节在这里和这里。

听上去,你要么试图强制执行 TLS 1.2 以外的东西(可能),要么你的 openssl 库太旧,它们不支持 TLS 1.2(低于 OpenSSL 1.0.1c 的任何东西,不太可能)。

您可能想尝试从 SDK 运行 TlsCheck.php

【讨论】:

猜你喜欢
  • 2016-08-14
  • 2019-12-21
  • 2016-05-04
  • 2016-04-27
  • 2016-12-12
  • 2015-12-02
  • 2017-05-14
  • 2016-07-05
相关资源
最近更新 更多