Error In Curl Request Unable To Use Client Certificate
Contents |
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 curl: (58) unable to use client certificate (no key found or wrong pass phrase?) more about Stack Overflow the company Business Learn more about hiring developers or posting
Curl Error 58
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community unable to set private key file: '' type pem Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Getting (58) unable to use client certificate (no key found
Curl 58 Unable To Load Client Key
or wrong pass phrase?) from curl up vote 3 down vote favorite I'm attempting to make test calls to a third-party API that requires a client cert. I generated a new cert using this command with openssl: req -new -newkey rsa:2048 -nodes -out mycsr.csr -keyout mykey.key I then sent them the csr, and they sent me back mycert.crt. I concatenated the cert and the key together: cat mycert.crt mykey.key curl client certificate authentication > mycertandkey.pem Finally, I added mycert.crt to the ca-certificates folder and ca-certificates.conf and ran "update-ca-certificates --fresh". Now, I'm trying to make curl call from bash using the following command: curl -X GET --cert mycertandkey.pem -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https://api.URL.com I've also tried: curl -X GET --cert mycertandkey.pem --cacert mycert.crt -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https://api.URL.com and: curl -X GET --cert mycertandkey.pem --cacert mycert.crt --key mykey.key -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https://api.URL.com And every other combination I can think of. I always get the error "curl: (58) unable to use client certificate (no key found or wrong pass phrase?)". The key doesn't have a passphrase. All of the cert/key files have 777 permissions. I haven't worked much with certs in the past and I feel like I've missed something, especially since I seem to have only one cert. Is the cert that the other company sent me a cacert or is it my client cert? Did I concatenate the private key to the wrong cert? I've found a lot of piecemeal information about this online, but if anyone knows of a good tutorial on this subject, I'd really appreciate that as well. ssl curl ssl-certificate share|improve this question edited Ja
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss
Curl Unable To Load Client Cert -8018
the workings and policies of this site About Us Learn more about
Curl P12
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow curlopt_sslcert Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each http://stackoverflow.com/questions/29799478/getting-58-unable-to-use-client-certificate-no-key-found-or-wrong-pass-phrase other. Join them; it only takes a minute: Sign up PHP CURL error: unable to use client certificate (no key found or wrong pass phrase?) up vote 1 down vote favorite I am doing this: $ch = curl_init(); curl_setopt($ch, CURLOPT_VERBOSE, '1'); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, '2'); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, '1'); curl_setopt($ch, CURLOPT_CAINFO, getcwd().'/public.pem'); curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/private.key'); curl_setopt($ch, CURLOPT_SSLCERTPASSWD, '1234'); curl_setopt($ch, CURLOPT_SSLKEYPASSWD, '1234'); http://stackoverflow.com/questions/33498093/php-curl-error-unable-to-use-client-certificate-no-key-found-or-wrong-pass-phr curl_setopt($ch, CURLOPT_URL, "http://api-xxxxxx.duosecurity.com/auth/v2/preauth"); $dataa = curl_exec($ch); I am getting this error: unable to use client certificate (no key found or wrong pass phrase?) What am I missing? If the code is ok then could you please guide me on how to generate a pair of certificates for this purpose using either openssl OR ssh-keygen? php ssl curl openssl ssh-keygen share|improve this question edited Nov 4 '15 at 11:25 asked Nov 3 '15 at 11:34 Bengali 8911 curl_setopt($ch, CURLOPT_SSLCERT, getcwd().'/public.pem'); curl_setopt($ch, CURLOPT_SSLKEY, getcwd().'/private.key'); –ojovirtual Nov 3 '15 at 11:38 @ojovirtual I tried that before and it gives me this error: error setting certificate verify locations: CAfile: /var/www/duo/api/src/duo.pem CApath: /etc/ssl/certs –Bengali Nov 3 '15 at 11:42 curl_setopt($link, CURLOPT_SSL_VERIFYPEER, FALSE); –ojovirtual Nov 3 '15 at 11:46 @ojovirtual that isn't allowed by the API I am trying to access with this CURL. –Bengali Nov 3 '15 at 11:48 A SSL certificate is composed by two parts: a certificate and a private key. My code above is
[ More options ] Related messages: [ Next message ] [ Previous message ] https://curl.haxx.se/mail/lib-2009-01/0007.html [ Next in thread ] [ Replies ] From: umesh https://curl.haxx.se/mail/lib-2009-03/0076.html d waghode
This message: [ Message body ] [ More options ] Related messages: [ Next message ] [ Previous message ] From: sourav roy