Skip to content

Useful OpenSSL Commands

Overview

Some useful OpenSSL commands for working with certificates and keys.

Commands

Download certificate chain from server:

Terminal window
openssl s_client -showcerts -connect example.com:443 </dev/null | sed -n -e '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > example.pem

Installing CA certificate to trusted store (Linux):

Terminal window
sudo cp example.pem /usr/local/share/ca-certificates/
sudo update-ca-certificates

Remove password from private key (from PEM):

Terminal window
openssl rsa -in key.pem -out key-out.pem

Concatinate public and private key:

Terminal window
cat certificate.pem key.pem > combined.pem