Curl_exec Error 58 Unable To
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company php curl exec Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs
Php Exec Curl Post
Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers,
Curl Multi Exec
just like you, helping each other. Join them; it only takes a minute: Sign up unable to set private key file: './cert.pem' type PEM up vote 14 down vote favorite 2 I am using curl to download
Python Exec Curl
data from a https site using public certificate files. System information: OS: fedora 14 curl: curl 7.30.0 openssl: OpenSSL 1.0.0a-fips The command is, curl -v "https://" --cert "./cert.pem" --cacert "./cacert.pem" --cert-type PEM * About to connect() to kng.com port 443 (#0) * Trying 11.19.37.123... * Adding handle: conn: 0x8189e68 * Adding handle: send: 0 * Adding handle: recv: 0 * Curl_addHandleToPipeline: length: 1 * - Conn 0 (0x8189e68) send_pipe: 1, recv_pipe: 0 * Connected curl exec failed timeout was reached to fkng.com (11.19.37.123) port 443 (#0) * unable to set private key file: './cert.pem' type PEM * Closing connection 0 curl: (58) unable to set private key file: './cert.pem' type PEM I have have given all the permission to the .pem file, still curl is throwing an error. Thanks curl openssl share|improve this question edited Apr 11 at 13:52 Dacav 4,76013454 asked May 18 '13 at 13:18 user1495372 1051311 add a comment| 1 Answer 1 active oldest votes up vote 11 down vote After reading cURL documentation on the options you used, it looks like the private key of certificate is not in the same file. If it is in different file, you need to mention it using --key file and supply passphrase. So, please make sure that either cert.pem has private key (along with the certificate) or supply it using --key option. Also, this documentation mentions that Note that this option assumes a "certificate" file that is the private key and the private certificate concatenated! How they are concatenated? It is quite easy. Put them one after another in the same file. You can get more help on this here. I believe this might help you. share|improve this answer answered May 18 '13 at 18:54 doptimusprime 5,47531451 Thanks for your valuable information..Still one thing i dont understa
in my Payments Standard account? 42 1 day ago FAQ2066 unable to set private key file push notification Why am I not receiving funds for completed orders? 35 unable to set private key file php 14 days ago FAQ2065 How do I apply for Website Payments Pro? 38 14 unable to set private key file pem days ago FAQ2064 How do I make the phone field mandatory with Express Checkout? 36 35 days ago FAQ2063 How do I successfully http://stackoverflow.com/questions/16624704/unable-to-set-private-key-file-cert-pem-type-pem/16627835 complete an Express Checkout API call? 41 35 days ago FAQ2062 Where can I find PayPal Reporting information? 160 41 days ago FAQ2061 How do I use IPN in my third-party shopping cart for Express Checkout? 165 42 days ago FAQ2060 Are Adaptive Payments disputes applicable for EDM https://www.paypal-knowledge.com/infocenter/index?page=content&id=FAQ1091&actp=LIST merchants and/or partners? 198 49 days ago FAQ2059 Can you fund Adaptive Payments with PayPal Credit? 188 49 days ago FAQ2058 Why are my PayPal PLUS payments being declined? 233 49 days ago FAQ2057 What is Seller Protection? 190 49 days ago FAQ2056 How do I return customers to my merchant site after completing checkout? 238 58 days ago FAQ2055 Why does my code change when I paste it into my website and apply changes? 265 58 days ago FAQ2053 Why do customers get the error “PayPal cannot process your payment. Please contact the merchant to solve this issue”? 293 58 days ago FAQ2054 Why do I get the error “You must specify a valid parameters A3, P3, and T3 for a subscription.” 261 58 days ago Pages: 50 - [ 1 2 3 4 5 … 50 | Next ]
message ] [ Previous message ] From: Gonçalo Peres Date: Wed, 28 Sep 2005 02:35:15 +0100 Greetings CURL users! I just subscribed to https://curl.haxx.se/mail/archive-2005-09/0138.html the list and would like to share a problem and it's solution, http://honglus.blogspot.com/2012/03/fix-curl-client-certificate-error-curl.html after a couple of hours working around it... I was going to write to the list for help ;) I was having problems using Curl to connect to a https server using a client certificate. I believe i was doing everything by the book, but somehow Curl kept complaining unable to about the private key file. 1) I had a PKCS#12 file which contained the CA and Client certificates and the private key: "MULTICERT.p12" 2) I convert it to PEM format with: openssl pkcs12 -in MULTICERT.p12 -out cert.pem Enter Import Password: MAC verified OK Enter PEM pass phrase: Verifying - Enter PEM pass phrase: and the file cert.pem was created with all the unable to set certificates and the private key (i used "xxxxxx" for the PEM pass phrase). 3) However when i used Curl to connect to the https server curl -d "var1=value1&var2=value2&..." -G -v --cert cert.pem:xxxxxx https://www.somesite.com/page * About to connect() to www.somesite.com port 443 * Trying 123.123.123.123... * connected * Connected to www.somesite.com (123.123.123.123) port 443 * unable to set private key file: 'cert.pem' type PEM * Closing connection #0 curl: (58) unable to set private key file: 'cert.pem' type PEM 4) So then i tried to put the CA certificate, Client Certificate and Private Key in separate files: openssl pkcs12 -in MULTICERT.p12 -out ca.pem -cacerts -nokeys openssl pkcs12 -in MULTICERT.p12 -out client.pem -clcerts -nokeys openssl pkcs12 -in MULTICERT.p12 -out key.pem -nocerts and then i tried Curl again: curl -d "var1=value1&var2=value2&..." -G -v --key key.pem --cacert ca.pem --cert client.pem:xxxxxx https://www.somesite.com/page and it worked!!! :) Still don't know why the first method - having everything in one cert file - didn't work...!? Maybe the proivate key was'nt on the right order... Well, anyway, hope this helps anyone Cheers! -- Gonçalo Peres http://www.ClubeMyDVD.com - A MELHOR FORMA DE ALUGAR
worked fine Linux(curl 7.15.5 (x86_64-redhat-linux-gnu)) But the same command with the same certificate failed in Windows(curl 7.23.1 (x86_64-pc-win32)). $curl -k -s -o /dev/null --connect-timeout 5 -w "\ntime_total=%{time_total}\nhttp_code=%{http_code}\n" --cert cert2.pem: Pass123 --key cert2.pem -d @data.xml https://server1/ curl: (58) unable to set private key file: 'cert2.pem' type PEM This error could be due to invalid certificate password or invalid certificate format, It seems the curl in windows is picker on certificate format than the curl in Linux. In general, you can combine both certificate and key into one file by copy&paste the text in a text editor. But it seems the curl for Windows only accept the "formal format", which has additional lines of "Bag Attributes" ( or maybe just different behaviour in different versions) General certificate #cat cert1.pem -----BEGIN CERTIFICATE-----……………….. -----END CERTIFICATE----- -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,D49E12E8D074DA59…………….-----END RSA PRIVATE KEY----- "Formal" certificate with "Bag Attributes" Bag Attributes localKeyID: 92 47 FA AC C8 D4 94 D8 0C B0 D0 1D 9F D7 43 0B B5 D8 23 AD subject=/C=AU/ST=NSW/L=Sydney/O=ORG1/CN=client1issuer=/C=AU/ST=NSW/O=ORG1/CN=CA -----BEGIN CERTIFICATE-----………………….-----END CERTIFICATE-----Bag AttributeslocalKeyID: 92 47 FA AC C8 D4 94 D8 0C B0 D0 1D 9F D7 43 0B B5 D8 23 AD Key Attributes: -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,6F6BA23BB03B5049 ……………..-----END RSA PRIVATE KEY----- How to add the "Bag Attributes"? #I found the "bag Attributes" can be added by converting PEM to pkcs12 format then convert back to PEM. #Convert from PEM to PKCS12 $openssl pkcs12 -export -in cert1.pem -out cert1.pfx#C