Follow Below Steps convert PEM file into PFX file, you may Use this tool: https://www.sslshopper.com/ssl-converter.html
- Type of Current Certificate 'Standard PEM'
- Type To Convert To 'PFX/PKCS#12'
- Certificate File to Convert - Add 'cert.crt' or 'cert.pem'
- Add the 'Private Key'
- Chain Certificate File - Add 'CABundle.crt'
- Leave Chain Certificate File 2 blank
- Set a new 'PFX Password'
- Click on 'Convert Certificate'
Using Windows PowerShell
Generate a Self-Signed Certificate + Private Key
1. Generate a Self-Signed Certificate + Private Key
New-SelfSignedCertificate -DnsName "yourdomain.com" -CertStoreLocation "cert:\LocalMachine\My" -KeyExportPolicy Exportable
Export the .key file:
Open
certlm.msc
(Local Machine Certificates).Go to Personal → Certificates, right-click your cert → Export.
Select "Yes, export the private key" → Choose .PFX (PKCS#12) format.
Extract the
.key
file using OpenSSL:
openssl pkcs12 -in cert.pfx -nocerts -out private.key