Assuming a private_key.pem
and the associated certificate client_cert.pem
signed by CA (CSR signed with private_key.pem
).
Next, I create the pfx container with:
# create pfx with private_key.pem and client_certificate.pem
openssl pkcs12 -export -in client_cert.pem -inkey private_key.pem -certfile client_cert.pem -out client_cert.pfx
# extract from the pfx the private_key that was used.
openssl pkcs12 -in client_cert.pfx -nocerts -out private_key_extracted.pem -passin pass: -nodes
Comparing the two keys I see that they differ. The base64 part differs as well as the headers:
private_key.pem -> -----BEGIN RSA PRIVATE KEY-----
private_key_extracted.pem -> -----BEGIN PRIVATE KEY-----
Any tips on why this is the case? Are these the same private keys?