# 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
```
