To convert a PEM certificate file and a private key to PKCS#12 (.pfx .p12):
openssl pkcs12 -export -out cert..pkcs12 -inkey privateKey.key -in cert.crt -certfile CACert.crt
You need to concatenate all the PEM files into one, then convert it to PKCS#12:
cat certificate.crt intermediate.crt > bundle.crt openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in bundle.crt