How To Convert DER To PEM and PEM to DER Certificate Format with OpenSSL? – POFTUT

How To Convert DER To PEM and PEM to DER Certificate Format with OpenSSL?

DER and PEM are formats used in X509 and other certificates to store Public, Private Keys and other related information. OpenSSL provides a lot of features for manipulating PEM and DER certificates. We can use OpenSSL to convert DER to PEM format and vice versa.

Convert DER Format To PEM Format For RSA Key

We may have an RSA Key in DER format and we want to convert it into DER format. We will use the verbrsa with the following options.

  • -inform input format
  • -outform output format
  • -in input
  • -out the output which is converted format.

Convert PEM Format To DER Format For RSA Key

In this step, we will do the reverse and convert PEM formatted RSA Key to the DER format with the following command.

Convert DER Format To PEM Format For X509

X509 Certificates are popular especially in web sites and Operating systems. X509 certificates also stored in DER or PEM format. We can use OpenSSL to convert an X509 certificate from DER format to PEM format with the following command.

Convert PEM Format To DER Format For X509

We can convert X509 certificate from PEM format to DER format with the following command.

1 Response

  1. Oliver says:

    I think there is a typo on the last line:
    openssl x509 -inform PEM -outform DER -text -in mykey.pem -out mykey.der
    should be
    openssl x509 -inform PEM -outform DER -in mykey.pem -out mykey.der
    to produce binary (non-text) DER format.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)