Skip to main content

Converting PEM to crt and key

If you receive pem formatted certificate and key files from a CA registrar, you will need to convert them for use by a linux host.

Bundles and Chains

As well, it may be necessary to compose a certificate chain file, for the host, instead of a simple crt file.
Doing so, is required for Nginx and some mobile apps, as both require the CA authority certs to be in the same file as the host certificate.
To create a chain certificate, do this:

cat cert-start.pem ca-bundle.pem > full_chain.pem

Pem to Crt

To convert the cert file (from pem) to crt, do this:

openssl x509 -outform der -in your-cert.pem -out your-cert.crt

Pem to Key

To convert the private key (as pem) to key, do this:

openssl rsa -outform der -in private.pem -out private.key