Please follow the below steps to convert a PEM certificate to PFX.
Once you are in the OpenSSL folder, please execute the below command. This is to convert the PEM file to the key file. Make sure you are giving correct certificate paths.
openssl rsa -in E:\certificate\mycertificate.pem -out E:\certificate\private.key
It will ask for the passphrase, please type it and hit enter. Once it is successful you can see the below message.
openssl pkcs12 -export -out E:\certificate\mycertificate.pfx -inkey E:\certificate\private.key -in E:\certificate\mycertificate.pem -certfile E:\certificate\mycertificate.pem
#privatekey – Which we have created in step2
#pfx – output format
#pem – source format
Hit enter and it will ask you to provide an export password. Please note this password somewhere for future reference.
Confirm the password
Once confirmed you can see the pfx file in the output path.