简体   繁体   English

通过SSL的php SOAP调用-如何在请求中将证书,密钥和CA证书卡在一起?

[英]php SOAP call over SSL - How do I jam a cert, key, and CA cert together in the request?

So, I'm trying to consume a webservice using something like this: $client = new SoapClient("some.wsdl", array('local_cert' => "cert_key.pem")); 因此,我正在尝试使用如下方式使用Web服务:$ client = new SoapClient(“ some.wsdl”,array('local_cert'=>“ cert_key.pem”));

I've done this successfully in the past with other web services that required a cert & key concatenated into the local_cert file. 过去,我已经通过需要将cert&key链接到local_cert文件中的其他Web服务成功完成了此操作。 Now, I'm trying to consume a service that also relies on a trusted CA. 现在,我正在尝试使用也依赖于受信任CA的服务。 This is a J2EE (Axis) webservice I'm consuming and every time I try to get opinions from the team hosting that service, they tell me that it must be a PHP issue... 这是我正在使用的J2EE(Axis)Web服务,每当我尝试从托管该服务的团队那里获取意见时,他们都会告诉我这一定是PHP问题...

The response I get from the SoapClient call is always a cannot connect. 我从SoapClient调用获得的响应始终是无法连接。 I used to be getting SSL errors, but then I realized I was using the wrong server cert, so now I at least know that I am on the right path of creating an SSL call. 我曾经遇到过SSL错误,但是后来我意识到我使用了错误的服务器证书,所以现在我至少知道我在创建SSL调用的正确路径上。

What I don't know is how to make sure the CA cert gets included in that local_cert file. 我不知道如何确保CA证书包含在该local_cert文件中。 I have my server cert, my server cert key, and the CA cert, but is there an order in which I concatenate them in local_cert? 我有我的服务器证书,我的服务器证书密钥和CA证书,但是在local_cert中将它们串联起来的顺序是什么? Am I completely missing something? 我完全错过了什么吗?

Thanks in advance 提前致谢

Neither IIS nor Apache, from my experience, require a CA file to authenticate a client certificate for web services. 根据我的经验,IIS和Apache都不需要CA文件来认证Web服务的客户端证书。 You need only specify the PEM file (and install it in the local store on IIS). 您只需要指定PEM文件(并将其安装在IIS上的本地存储中)。 I would say that your code looks good. 我会说您的代码看起来不错。 When SSL fails for some authentication reason, you will typically get Forbidden messages. 当SSL由于某种身份验证原因而失败时,通常会收到“禁止”消息。 Errors that say you can't connect might involve ports not being open, such as port 443 for SSL. 表示无法连接的错误可能涉及端口未打开,例如SSL的端口443。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM