andy1212 Posted July 27, 2013 Share Posted July 27, 2013 (edited) is this code setup right? // Get cURL resource $curl = curl_init(); // Set some options - we are passing in a useragent too here curl_setopt($curl, CURLOPT_URL, $request_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($curl, CURLOPT_CAINFO, '/public_html/cert/ca.crt'); //(<--- path to CA bundle) curl_setopt($curl, CURLOPT_SSLCERT, '/public_html/cert/mycert.pem'); //(<--- path to SSL certificate) curl_setopt($curl, CURLOPT_SSLKEY, '/public_html/cert/mykey.pem'); //(<--- path to RSA key) curl_setopt($curl, CURLOPT_SSLCERTPASSWD, 'password'); // Send the request & save response to $resp $result = curl_exec($curl); echo curl_error($curl); // Close request to clear up some resources curl_close($curl); I keep getting this error when executing this code, unable to use client certificate (no key found or wrong pass phrase?) Edited July 27, 2013 by andy1212 Quote Link to comment Share on other sites More sharing options...
requinix Posted July 27, 2013 Share Posted July 27, 2013 As I posted in the other thread you created for this exact same problem, which I've deleted because I don't want anyone else to make the same mistake of replying to one thread telling you to post code and then coming over here to discover it's the same question but this time with code, Programming tip #1: if you get an error message and don't know what it means, Google it. Looks like you need check the file permissions and that you have the right path to it in your script. Otherwise post the code. Turns out it was the "right path to it". The path to the file is not "/public_html/cert/*" because I doubt you have a public_html directory at the root of your drive. Next I would tell you what path to use except there's a problem: those files are web-accessible. That's horribly bad. Move them somewhere else not in or under the public_html directory. Then figure out what their actual paths are (spoiler: probably starts with something like "/home/andy1212") and substitute those into your code. Quote Link to comment Share on other sites More sharing options...
andy1212 Posted July 28, 2013 Author Share Posted July 28, 2013 ok ill try that and post back here with my results. thanks for the help Quote Link to comment Share on other sites More sharing options...
andy1212 Posted July 28, 2013 Author Share Posted July 28, 2013 would I use all three lines or just one or two of them. curl_setopt($curl, CURLOPT_CAINFO, '/home/ssl/certs/website.com.crt'); curl_setopt($curl, CURLOPT_SSLCERT, '/home/ssl/certs/website.com.crt'); curl_setopt($curl, CURLOPT_SSLKEY, '/home/ssl/certs/mykey.pem'); like do I have to give a path to the RSA key, CA bundle and SSL cert or just the SSL or just the CA bundle. There are a number of files I found on in the home/ssl/certs/ directory I found on the server and I'm not sure which ones to give paths to and where to put them in the code above. Some of the files have a .old.(a long number here) and I don't know if I should link to those because it says old, maybe those are the SSL files I had before I purchased this new SSL. I did Google the error message but couldn't find anyone that had a similar problem to what I'm trying to do. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.