Convert .PFX Certificate for Linux

11 May 2020 (Monday) 09:03pm

When you get a certificate from a Certificate from vendor or Colleagues. They will normally provide you the .PFX format. Then you have the challenges how to allocate the certificate in the Linux Server where it needs .CER and .KEY files. That will be challenge where normally the person who generate the .KEY File during certificate licensing will not keep the copy. Without the key your certificate will consider not compliance.

No need to worries how to convert the the .PFX format to .CER and .KEY format as command below via OPENSSH in Linux

openssl pkcs12 -in /path/to/vinclab.pfx -nocerts -out /path/to/vinclab_encrypted.key
openssl pkcs12 -in /path/to/vinclab.pfx -clcerts -nokeys -out /path/to/vinclab.cer
openssl rsa -in /path/to/vinclab_encrypted.key -out /path/to/vinclab.key

if you want to see all in one text file than later manually extract out. you can do the following command
openssl pkcs12 -in /path/to/vinclab.pfx -out /path/to/vinclab.txt -nodes

In the vinclab.txt file that generate will contain 4 cetificates. There are Private Key, Certificate, Root CA and CA certificate. You just need to copy and paste into files. That it you already manage to get the .CER and .KEY format Certificate. That is common challenge when you struggle to get the .KEY from the initial person generate the CSR.


Flowers