How To Use Curl with HTTPS Protocol and URLS?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-use-curl-with-https-protocol-and-urls/
PINTEREST
PINTEREST
INSTAGRAM

Curl is a command line tool and library which implements protocols like HTTP, HTTPS, FTP etc. Curl also supports HTTPS protocol which is secure version of the HTTP. Using curl may create some problems. We will examine how to solve these curl HTTPS related problems.

Install Curl

We will start with the installation of the curl tool with the following command.

Ubuntu, Debian, Mint, Kali:

Ubuntu, Debian, Mint, Kali:
Ubuntu, Debian, Mint, Kali:

Fedora, CentOS, RHEL:

SSL/TLS Problems

Especial in self signed or expired X.509 or SSL/TLS certificates may create problems. The error detail is printed to the terminal. As an example we will try to access https://www.wikipedia.com and we will get error like

AND we run following command.

curl SSL/TLS Problems
curl SSL/TLS Problemspto

Allow Insecure Connections

In order to prevent this error and accept insecure certificate we need to provide --insecure . This will accept all provided  certificates without complaining it.

Allow Insecure Connections
Allow Insecure Connections

Provide Site HTTPS Certificate Manually

If we do not want to use web site provided certificate and provide sites HTTPS certificate manually we can use -E or --cert option with the certificate file. In this example we will use certificate named wk.cert in order to connect https://www.wikipedia.com .

Provide Certificate Authority Certificate Explicitly

In some cases we may need to use another certificate chain then internet. Certificate chains provide trust relationship between hierarchical certificates where leaf is the site certificate we want to navigate. Certificate Authority is the top certificate which is provided by Certification Auhtority firms. We can provide another certificate authority like our company local certificate authority with the --cacert option.

LEARN MORE  What Is OpenSSL Library?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-use-curl-with-https-protocol-and-urls/
PINTEREST
PINTEREST
INSTAGRAM