[Cloudmatika] How to Convert an SSL/TLS File to .pfx on Linux

SSL or Secure Socket Layers (equal to Transport Layer Security [TLS]) is a cryptic protocol designed to ensure security while communicating through computer networks. Cloudmatika, as one of Indonesian cloud services pioneers, has services to provide SSL/TLS to web developers with affordable prices. SSL/TLS provided from Cloudmatika will be texted and stored by text editors to .peers or .crt. However, sometimes certificate authority (CA) for SSL/TLS uses different file extensions from .pem or .crt such as .pfx, .p7b or .der. Here will be explained how to convert SSL/TLS .pfx files. 


Converting .pfx to .pfx


Here's how to convert .pfx files into .pfx


Step 1: Download openssl in root

  • Download and install opensl on your device
apt-get install openssl
dnf install openssl
yum install openssl

Step 2: Move to directory with certificate, privatekey and CA files

  • Make sure 3 files are SSL/TLS, certificate, privatekey and certificate signing request (CSR)/CA/chain with the extension .crt or .per are in the same directory. If the file is still in the .pem format, use syntax
mv certificate.pem certificate.crt
mv privkey.pem privatekey.crt
mv chain.pem CAcert.crt  --OR--  mv csr.pem CAcert.crt  --OR-- mv ca.pem CAcert.crt  

            to make file extended .pen into .crt  

Step 3: Run openssl

  • When already in the right directory and the required files are available, run syntax
openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CAcert.crt

        

         And voila, the file with the name certificate.pfx is ready ondeploy It's easy, isn't it?
         Happy programming.

[Cloudmatika] How to Install PHP on CentOS
[Cloudmatika] How to Use a SECTIGO Comodo SSL/TLS Certificate on Zimbra