How to Use OpenSSL to Convert Certificates or Keys Between PEM and DER

Moderator: cah

Post Reply
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

How to Use OpenSSL to Convert Certificates or Keys Between PEM and DER

Post by cah »

Here are the commands:

To convert a certificate from PEM to DER:

Code: Select all

# openssl x509 -in input.crt -inform PEM –out output.crt -outform DER
To convert a certificate from DER to PEM:

Code: Select all

# openssl  x509 -in input.crt -inform DER -out output.crt -outform PEM
To convert a key from PEM to DER:

Code: Select all

# openssl  rsa -in input.key -inform PEM -out output.key -outform DER
To convert a key from DER to PEM:

Code: Select all

# openssl rsa -in input.key -inform DER -out output.key -outform PEM
CAH, The Great
Post Reply