If you have a .pfx or .pem file, use OpenSSL to extract the private key:

Or for a .crt and .key pair, your private key is in the .key file.