我从提供程序获取了两个证书文件,一个格式为.cer格式,另一个格式为.p7b格式。然后我将p7b证书转换为p12证书。凭借此证书,我可以从我的浏览器连接到wsdl。 然后我开始使用我在本网站上找到的一些说明将该证书转换为.pem格式。使用PHP连接到SSL加密的Web服务时遇到问题
cat test.pem key.pem > cert.pem
我的继承人为Web服务类结构:
public function __construct() {
$wsdl_url = 'https://url.to/web_service?wsdl';
$pass = 'passphrase';
$cert = 'cert.pem';
try {
$this->client = new SoapClient($wsdl_url, array('local_cert' => $cert, 'passphrase' => $pass));
} catch(SoapFault $e) {
print_r($e);
}
}
这里是错误:
openssl pkcs12 -clcerts -nokeys -out test.pem -in mycert.p12
openssl pkcs12 -nocerts -out key.pem -in mycert.p12
然后使用以下命令用钥匙梳理证书
SSL operation failed with code 1. OpenSSL Error messages: error:14094418:SSL routines:SSL3_READ_BYTES:tlsv1 alert unknown ca in /var/www/html/..
试图使用验证证书:
openssl verify cert.pem
给了我以下错误:
error 20 at 0 depth lookup:unable to get local issuer certificate
我也尝试使用下面的OpenSSL命令创建的.pem证书:
openssl pkcs12 -in mycert.p12 -out mycert.pem
验证这给了我好,但PHP给了我以下错误:
Unable to set local cert chain file `mycert.pem'; Check that your cafile/capath settings include details of your certificate and its issuer
我假设它应该有可能以某种方式工作,因为我可以通过我的浏览器使用.p12证书来访问wsdl。但是我无法找到解决方案,我应该如何继续。 在此先感谢。