简体   繁体   English

如何在PHP的Soap服务中验证证书?

[英]How to validate certificate in soap service in php?

We are sending certificate to soap service using following code 我们正在使用以下代码将证书发送到肥皂服务

$wsdl = "https://localhost/MyService/myservices.php?wsdl";
$local_cert = "C:\\SoapCerts\ClientKeyAndCer.pem";
$soapClient = new SoapClient($wsdl, array('local_cert' => $local_cert));
$theResponse = $soapClient->test();

But there is no reference to validate that certificate in service. 但是没有引用来验证服务中的该证书。 I just want to know how to validate the correct certificate in service code. 我只想知道如何在服务代码中验证正确的证书。

Try to put both private key and public key at the same PEM file. 尝试将私钥和公钥都放在同一个PEM文件中。 Something like this in linux: 在Linux中是这样的:

# cat publicKey.pem privateKey.pem > key.pem

So, check if the path to your PEM file is correct (escaping slashes): 因此,请检查您的PEM文件的路径是否正确(转义斜杠):

$local_cert = "C:\\SoapCerts\\ClientKeyAndCer.pem";

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

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