Jump to content

[SOLVED] CURL SSL Cert ( Key file wrong | Pass Phrase Incorrect )


ionik

Recommended Posts

Hello,

 

I am having a small issue with using a digital ID for server - server communication .... when I try to run the code I get the error message

 

unable to use client certificate (no key found or wrong pass phrase?)

 

My code is originally written in Python but I have translated it to PHP and CURL works the same across all languages  :shy:

 

I have the latest Version of cURL installed ( I manually updated it myself 2 days ago ) and the same error happens if I run it in the shell

 

curl --cert /xxx/digitalID.p12 --key /xxx/digitalId.pem --pass xxx https://xxxxxx.com

 

 

The PHP Code is as follows

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://xxxxxxx.xxx.com");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
curl_setopt($ch, CURLOPT_SSLCERT, '/home/xxx/xxx/digitalID.p12');
curl_setopt($ch, CURLOPT_SSLKEY, '/home/xxx/xxx/digitalID.pem');
curl_setopt($ch, CURLOPT_SSLCERTPASSWD, 'xxxxxx');
curl_setopt($ch, CURLOPT_SSLKEYPASSWD, 'xxxxxx');

curl_exec($ch);

curl_close($ch);

 

and the orginal Python code

c = pycurl.Curl()
c.setopt(pycurl.URL, FirstDataAPI_URL)
c.setopt(pycurl.HTTPHEADER, ["Accept:"])
c.setopt(pycurl.POST, 1)
c.setopt(pycurl.POSTFIELDS, urllib.urlencode(FirstDataAPI_PostData))
import StringIO
b = StringIO.StringIO()
c.setopt(pycurl.WRITEFUNCTION, b.write)
c.setopt(pycurl.FOLLOWLOCATION, 1)
c.setopt(pycurl.MAXREDIRS, 5)
c.setopt(pycurl.SSLCERT, '/home/dgiftcard/disney/ssl/digitalID.p12')
c.setopt(pycurl.SSLCERTPASSWD, 'xxx')
c.setopt(pycurl.SSLKEY, '/home/dgiftcard/disney/ssl/digitalID.pem')
c.setopt(pycurl.SSLKEYPASSWD, 'xxx')
c.perform()
results = b.getvalue()

Link to comment
Share on other sites

  • 1 year later...

Please don't bump very old threads. It's unlikely you'll get a reply, especially since the OP hasn't been active for over a year. If you have a similar issue make a new thread.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.