PHP:服务器到服务器的 TLS 连接
我需要在后端和 Web 服务 API 之间建立 TLS
连接。我在 Symfony 框架中使用 HttpClientInterface
类。我真的很想了解我在这里做什么。
情况是这样的:
- 我收到了一个包含我的证书及其私钥的
.p12
文件,这些文件已使用 openssl 提取到.pem
文件。在PHP: SSL context options
中,我设置了local_cert = /mypath/mycert.pem
、local_pk = /mypath/mykey.pem
和密码='pwtoextractfiles'
。 所有这些选项都是必要的吗?这里到底发生了什么? - 我还获得了服务器证书。我设置了cafile = /mypath/servercert.pem。但是,服务器证书的颁发者告诉我,我应该将服务器证书的颁发者添加为受信任的根,并将颁发者添加到我的信任存储中。 这是如何在 PHP 中完成的?我是否通过设置 cafile 选项正确完成了此操作?
I need to establish a TLS
connection between my backend and a web service API. I'm using the HttpClientInterface
class within the Symfony framework. I would really like to understand what I'm doing here.
This is the situation:
- I recieved a
.p12
file containing my certificate and its private key, these have been extracted with openssl to.pem
files. In thePHP: SSL context options
, I have setlocal_cert = /mypath/mycert.pem
,local_pk = /mypath/mykey.pem
andpassphrase = 'pwtoextractfiles'
. Are all these options neccessary? Whats happening here really? - I also got a server certificate. I set
cafile = /mypath/servercert.pem
. However the issuer of the server cert tells me I'm supposed to add the issuer of the server cert as trusted root and add the issuer in my trust store. How is this done in PHP? Have I done this correctly by setting the cafile option?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论