Member-only story

Converting Certificates With Using OpenSSL

Maciej
1 min readJan 6, 2021

--

Introduction

Below I will present commands which allow you to convert certificates/keys to different formats with using OpenSSL. It is very useful when we need it compatible with specific types of servers.

Let’s start

  • DER to PEM
root@vagrant:/home/vagrant# openssl x509 -inform der -in example.cer -out example.pem
  • PEM to DER
root@vagrant:/home/vagrant# openssl x509 -outform der -in example.pem -out example.der
  • PKCS#12 file with private key and certificates to PEM
root@vagrant:/home/vagrant# openssl pkcs12 -in example.pfx -out example.pem -nodes
  • PEM certificate file and a private key to PKCS#12
root@vagrant:/home/vagrant# openssl pkcs12 -export -out example.pfx -inkey example.key -in example.crt -certfile CACert.crt
  • PEM to CRT
root@vagrant:/home/vagrant# openssl x509 -outform der -in example.pem -out example.crt
  • PEM to P7B
root@vagrant:/home/vagrant# openssl crl2pkcs7 -nocrl -certfile example.cer -out example.p7b -certfile CACert.cer
  • PEM to PFX
root@vagrant:/home/vagrant# openssl pkcs12 -export -out example.pfx -inkey example.key -in example.crt -certfile CACert.crt
  • P7B to PEM
root@vagrant:/home/v…

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

No responses yet