name or passfooter is wrong 解决g

php - unable to use client certificate(no key found or wrong pass phrase?) - Stack Overflow
Join the Stack Overflow Community
Stack Overflow is a community of 7.0 million programmers, just like you, helping each other.
J it only takes a minute:
I am trying to make a SOAP call to a server using CURL as belows.
The Requirement is
We need to pass the ssl certificate and pass the Username and Password
$ssl = "ssl_file_relative_address.pem";
$pub_ssl_password = 'mynameiskhan';
//Get the data
$data = the_data_xml.
//Get the WSDL Address
$wsdl = "address/to/wsdl?parameter=value";
$soapUser = "Username";
$soapPassword = "password"; // password
$options = [
CURLOPT_RETURNTRANSFER =& TRUE,
CURLOPT_FOLLOWLOCATION =& TRUE,
CURLOPT_SSL_VERIFYHOST =& FALSE,
CURLOPT_SSL_VERIFYPEER =& FALSE,
CURLOPT_URL =& $wsdl,
CURLOPT_SSLCERT =& $ssl,
//CURLOPT_SSLCERTPASSWD =& $pub_ssl_password,
CURLOPT_USERPWD =& $soapUser.":".$soapPassword,
CURLOPT_HTTPAUTH =& CURLAUTH_BASIC
$ch = curl_init();
curl_setopt_array($ch , $options);
$response = curl_exec($ch);
//curl_close($ch);
if (curl_errno($ch)) {
print curl_error($ch);
I'm getting the following Error from CURL : unable to use client certificate (no key found or wrong pass phrase?)
What is it that I'm doing Wrong...
When you specify a client authentication certificate using CURLOPT_SSLCERT, the PEM file should contain a -----BEGIN CERTIFICATE----- line followed by the certificate.
You also need to supply cURL with the corresponding private key to the certificate using CURLOPT_SSLKEY which is a file beginning with -----BEGIN PRIVATE KEY-----.
If the private key is in ssl_file_relative_address.pem, then try copying the private key to a separate file.
If the private key is encrypted, you can specify the password using CURLOPT_SSLKEYPASSWD.
50.1k579115
Found the Solution. It required an intermediate CA Certificate.
The Solution is
$options = [
CURLOPT_HTTPHEADER =& ['Content-type: application/json'],
CURLOPT_URL =& 'https://address/to/service?param=value',
CURLOPT_SSL_VERIFYPEER =& 0,
CURLOPT_CAINFO =& getcwd()."\cacert.pem",
URLOPT_SSLCERT =& getcwd().'\cert.pem',
CURLOPT_SSLCERTPASSWD =& 'ssl_password',
CURLOPT_HTTPAUTH =& CURLAUTH_BASIC,
CURLOPT_USERPWD =& $soapUser.":".$soapPassword,
CURLOPT_POST =& 1,
CURLOPT_POSTFIELDS =& $data
$ch = curl_init();
curl_setopt_array($ch , $options);
$response = curl_exec($ch);
if (curl_errno($ch)) {
print curl_error($ch);
print_r($response);
curl_close($ch);
Do not forget to mention the CURLOPT_HTTPHEADER to its content type, it is important.
Also download the intermediate certificate from . It contains all the valid CA's.
Thanks @drew010 for help.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
The week's top questions and answers
Important community announcements
Questions that need answers
By subscribing, you agree to the
rev .25686
Stack Overflow works best with JavaScript enableddb:: 3.78::Error while extending controller: class name is wrong or not included x3
Widget settings form goes here()Hosting donated by Contents are & their respective authors, licensed under the
Reverse Proxy Mode

我要回帖

更多关于 footer is wrong 刷机 的文章

 

随机推荐