how to extract certificate and private key from pfx file

1. Extract the private key and certificate from the PFX file to a PEM file:

“c:\Program Files\OpenSSL-Win64\bin\openssl.exe” pkcs12 -in export_mail.microseven.net.2024.pfx -nodes -out mail-2024.pem 

if the error, you can go “c:\Program Files\OpenSSL-Win64\bin\openssl.exe” pkcs12 -in export_mail.microseven.org.2024.pfx -nodes -out mail-2024.pem -legacy

2. Extract the private key from the PEM file:

c:\Program Files\OpenSSL-Win64\bin\openssl.exe” rsa -in mail-2024.pem -out mail-2024.key

3. Extract the certificate from the PEM file:

“c:\Program Files\OpenSSL-Win64\bin\openssl.exe” x509 -in mail-2024.pem -out mail-2024.crt