# How to get the SSL certificate of a host?

If you know the hostname, you can download the SSL certificate by using Google Chrome, Mozilla Firefox, Internet Explorer or OpenSSL. Copy the hostname and paste it in the address bar of the browser of your choice and follow the steps corresponding to the selected browser given below.

## **Get SSL using Google Chrome** <a href="#id-8987" id="id-8987"></a>

Export the SSL certificate of a hostname using Google Chrome:

1\. Click the ***Secure*** button (a padlock) in an address bar.

![](https://miro.medium.com/max/387/1*miP1DQmmdFK5IfulxVGe8g.png)

2\. Click the ***Certificate(Valid)***.

![](https://miro.medium.com/max/381/1*CrXsJjtJmxb9qssYBeXbpA.png)

3\. Go to the ***Details*** tab.

![](https://miro.medium.com/max/387/1*7A6hJzYiu8fpnC-OVYA-Mw.png)

4\. Click the ***Copy to File…*** button.

5\. Click the ***Next*** button.

6\. Select the “Base-64 encoded X.509 (.CER)” format and click the ***Next*** button.

![](https://miro.medium.com/max/494/1*yUdLygG6goKDOg8zEIlRUw.png)

7\. Specify the name of the file you want to save the SSL certificate to.

8\. Click the ***Next*** and the ***Finish*** buttons.

## **Get SSL using Mozilla Firefox** <a href="#id-5fc0" id="id-5fc0"></a>

Export the SSL certificate of a hostname using Mozilla Firefox:

1\. Click the ***Site Identity*** button (a padlock) in an address bar.

![](https://miro.medium.com/max/518/1*4CJuhV3ksT7HfccUCQUKgQ.png)

2\. Click the ***Show connection details*** arrow.

3\. Click the ***More Information*** button.

![](https://miro.medium.com/max/477/1*nFYRUHrSsLX5Z35m_9Hy7g.png)

4\. Click the ***View Certificate*** button.

5\. Go to the ***Details*** tab.

![](https://miro.medium.com/max/452/1*1iEXFiXDG6sWmsqWbY4icg.png)

6\. Click the ***Export*** button.

7\. Specify the name of the file you want to save the SSL certificate, keep the “X.509 Certificate (PEM)” format, and click the ***Save*** button.

## **Get SSL using Internet Explorer** <a href="#aae8" id="aae8"></a>

Download and save the SSL certificate of a hostname using Internet Explorer:

1\. Click the ***Security report*** button (a padlock) in an address bar.

![](https://miro.medium.com/max/455/1*tf15At9DYLx-wKNK4sc_aQ.png)

2\. Click the View Certificate button.

![](https://miro.medium.com/max/477/1*eQeDzDXRuSzIAfqsYx6etQ.png)

3\. Go to the ***Details*** tab.

4\. Click the ***Copy to File***… button.

5\. Click the ***Next*** button.

6\. Select the “Base-64 encoded X.509 (.CER)” format and click the ***Next*** button.

7\. Specify the name of the file you want to save the SSL certificate to.

8\. Click the ***Next*** and the ***Finish*** buttons.

## **Get SSL using OpenSSL** <a href="#id-3232" id="id-3232"></a>

Get the SSL certificates of a hostname using the OpenSSL command :

```
$ echo | openssl s_client -servername NAME -connect HOST:PORT |\
sed -ne ‘/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p’ > certificate.crt
```

**Explanation :**

**`connect HOST:PORT`** - The host and port to connect to.

**`server name NAME`** - The TLS SNI (Server Name Indication) extension (website).

**`certificate.crt`** - Save the SSL certificate to this file.

**Example**:

```
$ echo | openssl s_client -servername einv.cleartax.in -connect einv.cleartax.in:443|\
sed -ne ‘/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p’ > certificate.crt
```
