I am attempting to use OpenSSL to Convert a PEM File and RSA Private Key to a PFX file. Here is the example command I attempted to use:
openssl pkcs12 -export -out cert.pfx -inkey key.pem -in cert.pem
In doing so, I receive the following error message:
unable to load private key
9068:error:0906D06C:PEM routines:PEM_read_bio:no start
line:pem_lib.c:696:Expecting: ANY PRIVATE KEY
The cert file looks like this:
-----BEGIN CERTIFICATE-----
....
-----END CERTIFICATE-----
and the Private Key looks like this:
-----BEGIN RSA PRIVATE KEY-----
....
-----END RSA PRIVATE KEY-----
I did some digging on the error but I have not found a solution yet.
EDIT
After some additional research it appears to be a problem with different openssl versions.
If I run it on my OSX system which is running 0.9.8zh 14 Jan 2016, these statements work fine.
However, if I run it on a Windows Machine with version OpenSSL 1.0.1p 9 Jul 2015 and OpenSSL 1.1.0g 2 Nov 2017, I get the above errors.