- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
在 IHE Connectathon 的上下文中,我想制作一个响应 ATNA 配置文件的原始套接字服务器,这需要具有两端证书的 TLS 套接字。
如果在此消息中总结我的问题: https://groups.google.com/d/msg/eu_connectathon/O-VGI_3cltw/ARsElA65ZkkJ
编辑:抱歉,Google 网上论坛不公开,消息如下:
Hi Florian,
What exactly does the error message "Server asked for a certificate, but list of issuers doesn't contain valid certificate authority." mean and did the implementation of the TLS Tools Client change during the last years, or am I using the wrong certificates?
该消息表示服务器已发送 CertificateRequest 在 certificate_authorities 中没有值的情况下发送给 clienmt 的消息 字段。
我去年遇到过这个问题并与开发人员讨论过 TLS 工具。他声称如果服务器不包含这个 现场,客户不知道什么样的证书 返回,假设您将连接前多个 亲和域,每个域都有自己的 CA。
看来您可以通过以下方式指示 OpenSSL 返回此值 调用 SSL_CTX_set_client_CA_list,例如在 DcmTLSTransportLayer::addTrustedCertificateFile。我没有测试过这个 还没有使用 TLS 工具,但我希望在 连接马拉松开始。
但我的 PHP 实现与他们的不同。看起来 PHP 缺少“SSL CTX 设置客户端 CA 列表”的可能性,以告诉客户端它应该使用哪个证书颁发机构。
$context = stream_context_create();
if ($certificate) {
// Server certificate + private key
stream_context_set_option($context, 'ssl', 'local_cert', "/path/to/server.pem");
stream_context_set_option($context, 'ssl', 'passphrase', $passphrase);
// Client public certificates
stream_context_set_option($context, 'ssl', 'cafile', "/path/to/ca.pem");
stream_context_set_option($context, 'ssl', 'allow_self_signed', false);
stream_context_set_option($context, 'ssl', 'verify_peer', true);
stream_context_set_option($context, 'ssl', 'peer_name', "TlsTools2");
stream_context_set_option($context, 'ssl', 'capture_peer_cert', true);
stream_context_set_option($context, 'ssl', 'capture_peer_cert_chain', true);
}
$this->__socket = @stream_socket_server("tcp://$address:$port", $errno, $errstr, STREAM_SERVER_BIND | STREAM_SERVER_LISTEN, $context);
IHE Gazelle TLS 客户端告诉我“服务器请求证书,但颁发者列表不包含有效的证书颁发机构。”
客户端和服务器之间的消息通过,但测试不成功,如消息所述“不够安全”。
您看到问题了吗?PHP 是否有更多我没有看到的选项?
感谢您的帮助。
编辑:正如@rdlowrey 建议的那样,我刚刚创建了一个错误报告:https://bugs.php.net/bug.php?id=69215
最佳答案
正如我在最初的评论中提到的:
PHP's stream server implementation has never actually used SSL_CTX_set_client_CA_list() for encrypted streams.
这已在相关错误报告中引用的上游得到更正:
https://bugs.php.net/bug.php?id=69215
此更改将在 PHP 5.6.8 二进制文件发布后反射(reflect)出来(或者您可以在该版本发布之前针对当前源手动构建 PHP)。
使用更新的二进制文件,OP 的示例代码无需修改即可按预期工作。在服务器中使用的加密上下文的一个简单示例:
<?php
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => '/path/to/my-server-cert.pem',
'passphrase' => 'elephpant',
'cafile' => '/path/to/my-ca-certs.pem',
'verify_peer' => true
]]);
在上面的示例中,当作为 TLS 握手的一部分发送客户端 CA 列表时,PHP 自动使用在上面引用的 my-ca-certs.pem
文件中找到的证书的名称。
当通过 "verify_peer"=> true
在加密服务器流中启用对等验证时,PHP 不会自动启用对等名称验证。除非您只希望允许单个证书持有者(具有特定的已知名称)访问您的服务器,否则这正是您想要的。此默认行为支持更常见的用例,即允许其证书由受信任的 CA 签名的任何客户端建立与您的服务器的连接。但是,如果您希望在加密服务器中强制执行名称验证,请修改上面的上下文示例,如下所示:
<?php
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => '/path/to/my-server-cert.pem',
'passphrase' => 'elephpant',
'cafile' => '/path/to/my-ca-certs.pem',
'verify_peer' => true,
'verify_peer_name' => true, // verify the name on the cert
'peer_name' => 'zanzibar' // ensure the cert's name matches this
]]);
关于php - 如何在 PHP 中将受信任的证书颁发机构列表设置为套接字客户端?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28696886/
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 6 年前。 Improv
我们最近构建了一个 Web 生成器应用程序(所见即所得、预先设计的模板、购物车等)。我们一直在寻找 SSL 证书的几个不同选项,甚至是通配符,以寻求解决方案。问题是我们不想每次有客户想要将 SSL 添
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 6 年前。 Improve
我想这是不可能的,但如果是这样,我想知道为什么。 假设我从附近的官方证书颁发机构之一获得了 example.com 的 SSL 证书。假设我正在运行 a.example.com 和 b.c.d.exa
在我的 java 应用程序中,我有一个带有自签名证书/ key 的 JKS keystore 。我需要加载它们并将它们转换为 BouncyCaSTLe 类型。 我正在使用 java.security.
我不是这方面的专家,但我只是遵循 Android 开发者网站上列出的代码 keytool -genkey -v -keystore orbii.jks-keyalg RSA -keysize 2048
我正在为我的一个应用程序实现推送通知系统,所以我正在关注 this教程并为此生成 SSL 证书。 我的这个应用程序还涉及应用程序和服务器之间的一些数据交换,我希望它受到 SSL 保护,我想知道从 ve
可能这是重复的问题,但我没有从上一个问题中完全清楚,这就是我发布新问题的原因。请看看这个。我会将 Ca 证书放在我的资源文件夹中以验证 ca 认证的证书,服务器中也会有相同的 ca 证书。 我正在创建
首先,我想指出这在 Internet Exporer 11 上运行良好。但出于某种原因,我无法让 FireFox 正常运行! 所以我已经添加了我自己的 rootCA 安全证书,在 Internet E
我有域“www.example.com”的 SSL 证书,我已将此证书安装在运行良好的端口 80 上的 tomcat 服务器中。现在我的要求是在 https 中运行 php 代码,因为我的 Apach
我正在构建一个 oauth 1.0a 服务,它将被 Jira 中的一个小工具使用,它是一个用 C# 编写的 .Net 3.5 应用程序。 Jira 使用 RSA-SHA1 签名方法向此服务发出请求,这
假设用户打开 https://ssl-site.example/link/index.php我用 ProxyPass 配置了我的服务器和 ProxyPassReverse在 Apache 配置中(在
我有一个 tcp 服务器,它使用证书进行 ssl/tls 和许可。对于 ssl/tls,证书存储在 pkcs#12 文件中,我认为该文件将作为安装过程的一部分进行安装。 关于 Rhino 许可,作为安
我开始想第一次在 jmeter 中记录。 我的步骤是: 我在 mac 上安装了 jmeter:brew install jmeter 我创建了新的录音模板 我点击开始按钮。它显示如下图所示的弹出窗口。
通常,我的困惑似乎正在从我在WCF上下文中理解安全性的尝试中消除。在WCF中,似乎可以将证书用于身份验证和加密。基本上,我试图理解: 如何将X509证书用作身份验证令牌? ssl证书通常不公开吗?这是
我正在尝试使用 openssl 库让客户端通过 https 连接到某些服务器。 调用堆栈是这样的: SSL_library_init(); SSL_load_error_strings(); SSL_
我正在阅读 this article其中解释了 iOS/OSX 中的代码签名。 我知道从KeyChain Access utility 我可以看到我的证书,如果展开我的开发者证书,我可以看到有一个私钥
我有一个既在互联网上又在私有(private)网络上的服务器。 我正尝试按照我的经理的要求在内部专用网络上设置 TLS。 该服务可供 Internet 和私有(private)内部网络客户端使用。 外
我在具有不同域扩展名的单个网络服务器中设置了我的站点,例如 https://mybusiness.com https://mybusiness.com.au https://mybusiness.co
我正在开发一个移动应用程序。我是网络开发的新手。 我在 GoDaddy 上有 DNS(比如 app.test.com)并且有一个只有 IP 地址的服务器(比如 31.254.42.73)。我的请求从
我是一名优秀的程序员,十分优秀!