Converting PEM to PKCS12 using OpenSSL

January 2, 2025

Summary

Here’s a quick guide to convert PEM to PKCS12/PFX file using OpenSSL.

Scenario 1

I have a PEM file with certificate and key.

openssl pkcs12 -inkey file.key -in file.pem -export -out file.pfx

Scenario 2

I have a PEM file with certificate info but no key.

openssl pkcs12 -export -nokeys -in file.pem -out file.pfx