curl on Windows with SSL

I downloaded the cacert.pem file (I placed it within an editor, so it is currently in CR/LF format on WInodws, not the normal Unix format)

I type the cacert.pem file

C:\curl>type \curl\cacert.pem   | more
##
## Bundle of CA Root Certificates
##
## Certificate data from Mozilla downloaded on: Wed Aug 20 03:12:04 2014
##
## This is a bundle of X.509 certificates of public Certificate Authorities
## (CA). These were automatically extracted from Mozilla's root certificates
## file (certdata.txt).  This file can be found in the mozilla source tree:
## http://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/
lib/ckfw/builtins/certdata.txt
##
## It contains the certificates in PEM format and therefore
## can be directly used with curl / libcurl / php_curl, or with
## an Apache+mod_ssl webserver for SSL client authentication.
## Just configure this file as the SSLCACertificateFile.
##
## Conversion done with mk-ca-bundle.pl verison 1.22.
## SHA1: bf2c15b3019e696660321d2227d942936dc50aa7
##


GTE CyberTrust Global Root
==========================
-----BEGIN CERTIFICATE-----

Open in new window


Then I try the following command:

C:\curl>curl -H "Content-Type: application/json" -d @input3.txt --cacert /curl/c
acert.pem https://www.google.com
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-wi
dth">
  <title>Error 405 (Method Not Allowed)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{backgrou
nd:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height
:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/error
s/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflo
w:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (m
ax-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0
}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@
media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.
com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:
url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}@media only screen and (
-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/e
rrors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{displ
ay:inline-block;height:55px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>405.</b> <ins>ThatΓÇÖs an error.</ins>
  <p>The request method <code>POST</code> is inappropriate for the URL <code>/</
code>.  <ins>ThatΓÇÖs all we know.</ins>
C:\curl>

Open in new window


What is the problem with this command?

Thanks
Anthony LuciaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

GaryCommented:
Just try a simple test to see if the SSL is being negotiated

curl https://www.google.com

And you should get back the Google search page code.
0
Anthony LuciaAuthor Commented:
I tried the following:

C:\curl>curl https://www.google.com
curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

Open in new window



So yes, it appears that the SSL is being negotiated, but unsucessfully
0
GaryCommented:
Forgot to add the cert path - change /curl/cacert.pem to the absolute path e.g. c:/path/file

curl  --cacert /curl/cacert.pem https://www.google.com
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Security

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.