Link to home
Start Free TrialLog in
Avatar of Anthony Lucia
Anthony Lucia

asked on

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
Avatar of Gary
Gary
Flag of Ireland image

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.
Avatar of Anthony Lucia
Anthony Lucia

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial