If you need to use a certificate contained in pfx file for httpd f.e. you could use the following to extract what you need:
openssl pkcs12 -in domain.pfx -clcerts -nokeys -out domain.cer openssl pkcs12 -in domain.pfx -nocerts -nodes -out domain.key
Hint: Use a password to protect the certificate while exporting it to pfx format. If you didn’t open the certificate on a windows system and follow the import wizard. When it comes to the point where you could enter a passwort, the wizard displays, that it is not needed. Here you can select the „Show password“ button to see the used key. This can be used during openssl export.