Requires the passcode for the .pfx file prior.
Extract .key file from .pfx file (will need to set a password here too):
openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]
Extract .crt file from .pfx file:
openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [certificate.crt]
Extract pem formatted .key from previous .key:
openssl rsa -in [keyfile-encrypted.key] -outform PEM -out [keyfile-encrypted-pem.key]
Source: