I would like to download a certificate in PEM format...

-----BEGIN CERTIFICATE-----
XoSDIKaItcRzMGrVqFPY9lG72Oe68lnLZWYQSkvqePC/04QnapOP...
(...)
-----END CERTIFICATE-----

...directly from a web browser, visiting a HTTPS website. Is there any browser function or add-on that allows doing so?

I'm using Chrome under Win10 but answers about other browsers/OSes can be useful.

I'm not trying to do this using UNIX command line tools e.g.

openssl s_client -connect mysite:443 > tmpfile
  • Which browser? Which Operating System? – garethTheRed Feb 2 at 18:13
  • Chrome under Win10 but it isn't strictly important. – dr01 Feb 5 at 8:12
  • Generate the PEM, put it in a directory (that's accessible) and download it? – Seth Feb 5 at 8:38
  • @Seth I don't want to generate a certificate, I want to download it from a existing HTTPS website. – dr01 Feb 5 at 8:44
up vote 2 down vote accepted

A PEM is a particular format. If you don't have a file in PEM format you won't be able to download it as a PEM file. What you can do is get the certificate information and convert it to whatever format you need.

From your responses it doesn't look like you're actually interested in downloading file but rather saving a certificate that's used for an HTTPS connection as a PEM file. In that case (at least for Firefox and Chrome) view the details of the certificate that is being used and choose to save it as a file.

For Firefox do the following:

Click on the Lock > Arrow > More Information > View Certificate > Details > Export

Fore Chrome:

Click on the Lock > Valid > Details > Copy to File

Save a certificate using chrome

The actual save function won't allow for a PEM so you will have to convert it afterwards e.g. using openssl.

How to save a remote server SSL certificate locally as a file also contains information in case it's not possible to view that information in your chrome using these steps.

For steps on how to convert the resulting file have a look at How to convert .crt to .pem [duplicate]. It's essentially openssl x509 -in mycert.crt -out mycert.pem -outform PEM.

  • 1
    Thanks, this worked. Actually there's no need to use OpenSSL, it's possible to save the cert in PEM format by selecting the second option "Base-64 encoded X.509 (.CER)" after "Copy to file". – dr01 Feb 5 at 9:10

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.