【问题标题】:Execute openssl s_client with php用php执行openssl s_client
【发布时间】:2013-07-04 18:03:00
【问题描述】:

我正在尝试从 PHP 连接到 .me 注册商 EPP OT&E 服务器,但没有成功。 我正在使用 php-epp 库 (https://github.com/centralnic/php-epp) 但问题是我无法打开连接。

我可以使用以下命令打开一个连接(或者至少看起来是这样):

openssl s_client -connect ote1.meregistry.net:700 -cert certificate.crt -key privateKey.key -CAfile PCA-3.pem -showcerts -state

返回:

已连接(00000003)

SSL_connect:在/连接初始化之前

SSL_connect:SSLv2/v3写客户端hello A

如何在 PHP 中重现此命令?我试过这个没有成功:

 $context = stream_context_create();
 stream_context_set_option($context, 'ssl', 'local_cert', 'pemcertificate.pem');
 stream_context_set_option($context, 'ssl', 'passphrase', '');
 stream_context_set_option($context, 'ssl', 'cafile', 'PCA-3.pem');
 stream_context_set_option($context, 'ssl', 'verify_peer', false);
 stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
 $epp = new Net_EPP_Client();
 echo "\nConnecting..";
 $epp->connect('ote1.meregistry.net', 700, 20, true, $context);

我收到此错误:

stream_socket_client():SSL 操作失败,代码为 1。OpenSSL 错误消息:错误:14094410:SSL 例程:SSL3_READ_BYTES:sslv3 提醒握手失败

有什么建议吗?

谢谢

【问题讨论】:

    标签: php openssl


    【解决方案1】:

    我发现了问题:我使用的证书无效。

    此外,对于某些服务器,命令 openssl s_client 需要一个标志 -no_tls1 以允许该命令正确执行。

    希望对其他人有用!

    【讨论】:

      猜你喜欢
      • 2011-03-14
      • 1970-01-01
      • 2014-01-16
      • 2019-09-24
      • 1970-01-01
      • 1970-01-01
      • 2012-06-05
      • 2015-11-12
      • 2014-10-06
      相关资源
      最近更新 更多