How to obtain public key as .cer or .txt file

Hi, I am using RSA 4096-bit SSL config, I need my public key as .cer or .txt format.
currently, live folder shows {cert,chain,fullchain,privkey}.pem

those are ascii encoded files – you can use them directly

otherwise: you can probably just make another symlink with the extension you want.

ln -s /etc/letsencrypt/live/__certname__/fullchain.pem /path/to/whatever.txt

(only use cert instead of fullchain if your application also wants chain.pem – or if it won’t work otherwise)

if you need to convert, check the various openssl manpages, like this: https://www.openssl.org/docs/man1.0.2/man1/x509.html

If you really meant that you want the public key (as opposed to the private key), you can do:

openssl pkey -in /etc/letsencrypt/live/example.com/privkey.pem \
-pubout -out public.txt
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.