php - 错误 :error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

标签 php ssl curl paypal server

$ch = curl_init();
$clientId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
$secret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

curl_setopt($ch, CURLOPT_URL, "https://api.sandbox.paypal.com/v1/oauth2/token");
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $clientId.":".$secret);
curl_setopt($ch, CURLOPT_POSTFIELDS, "grant_type=client_credentials");
$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);

这段代码在本地主机上工作,但是当我在我的实时服务器上测试时,它会给我这个错误 Error:error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure 然后我尝试了这个

<?php
$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL, "https://tlstest.paypal.com/"); 
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');
var_dump(curl_exec($ch));
if ($err = curl_error($ch)) {
var_dump($err);
echo "DEBUG INFORMATION:\n###########";
echo "CURL VERSION";
echo json_encode(curl_version(), JSON_PRETTY_PRINT);
}?>

github.com/paypal/TLS-update/tree/master/php 这将再次在 localhost 和 live 上运行它给了我这个

error bool(false)
string(67) "Unknown SSL protocol error in connection to tlstest.paypal.com:443 "
DEBUG INFORMATION:
###########CURL VERSION

我的服务器有这些证书

服务器 key 和证书#1

Subject *.secure.xxxxxxxx.com


Fingerprint SHA1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Pin SHA256: S4/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Common names    *.secure.xxxxxxxx.com   MISMATCH


Alternative names   *.secure.xxxxxxx.com



Key RSA 2048 bits (e 65537)


Weak key (Debian)   No


Issuer  Symantec Class 3 Secure Server CA - G4


AIA: xxxxxxx/ss.crt


Signature algorithm SHA256withRSA


Extended Validation No


Certificate Transparency    Yes (certificate)


OCSP Must Staple    No


Revocation information  CRL, OCSP


CRL: xxxxxx/ss.crl


OCSP: xxxxxxxxx


Revocation status   Good (not revoked)

Trusted No   NOT TRUSTED (Why?)

#2

Subject Symantec Class 3 Secure Server CA - G4


Fingerprint SHA1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Pin SHA256: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Key RSA 2048 bits (e 65537)


Issuer  VeriSign Class 3 Public Primary Certification Authority - G5


Signature algorithm SHA256withRSA

#3

Subject VeriSign Class 3 Public Primary Certification Authority - G5


Fingerprint SHA1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Pin SHA256: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Key RSA 2048 bits (e 65537)


Issuer  VeriSign, Inc. / Class 3 Public Primary Certification Authority

Signature algorithm SHA1withRSA   WEAK

**Protocols**


TLS 1.2 Yes


TLS 1.1 Yes


TLS 1.0 Yes


SSL 3   No


SSL 2   No

enter image description here

检查要求at

最佳答案

TL;TR:您的软件太旧,无法支持这些服务器。

这两个服务器都只支持 TLS 1.2,这在检查 SSLLabs 时可以看出。 .您的 OpenSSL 版本是 1.0.0s,尚不支持 TLS 1.2。仅从 1.0.1 开始提供支持。

my server have these certificates ...

您的 Web 服务器的设置(即证书、TLS 版本...)无关紧要,因为在这种情况下您是连接到其他服务器的客户端。

关于php - 错误 :error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38794133/

相关文章:

php - php中的连接函数与按钮

PHP 重命名包含 utf-8 阿拉伯字符集字符串的文件名失败

php - curl 穿过已经打开的套接字

php - CSV 或 Mysql 用于静态数据?

php - 根据单击的按钮更新表时的情况语句?

ssl - 客户端 SSL 不适用于 AWS API Gateway

magento - 如何在 magento 管理面板中启用/查看隐藏的选项卡?

security - 我需要找到易受攻击的 openssl,以便我可以对其进行测试

Curl 拒绝访问

php - 在 PHP 中使用curl 连接到在证书包中提供过期根证书的站点