22 C
Dubai
Sunday, December 22, 2024

Converting PFX File to PEM file using OpenSSL in Windows 10

I am converting PFX File to .Pem file using OpenSSL in Windows 10.

Some Applications never allow .pfx files to import directly. Running the Ubuntu Bash shell becomes much simpler in Windows 10

In Windows 10, you can have a Linux subsystem. It’s a great feature for sys admins for these sorts of tasks.

Start – Run – Appwiz.cpl – Turn Windows Features on or off.

image
image
image

Note: All Commands and Directory Names are Case Sensitive

List the Drives you can mount –

cd /mnt/

Press TAB to list the Drives.  Mounting F Drive.

cd /mnt/f
image
image

Change Directories get inside c:\cert –

cd /mnt/f/cert/

List Directories –

ls
image

To Export the private key from the Pfx File and Make .PEM file –

openssl pkcs12 -in mycert.pfx -nocerts -out key.pem -nodes
image

To Export Certificate from the Pfx file to .PEM file –

openssl pkcs12 -in mycert.pfx -nokeys -out cert.pem
image

Remove the Passphrase from Key.Pem File (Optional) –

openssl rsa -in key.pem -out server.key
image

To Export to .crt

openssl pkcs12 -in mycert.pfx -clcerts -nokeys -out mycert.crt

Remove the Passphrase from Key.Pem File (Optional) –

You can see below files  –

Known issues –

Error outputting keys and certificates
805BA41FAD7F0000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:../crypto/evp/evp_fetch.c:349:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()

openssl pkcs12 -in mycert.pfx -nokeys -out cert.pem -legacy

Satheshwaran Manoharan
Satheshwaran Manoharanhttps://www.azure365pro.com
Award-winning Technology Leader with a wealth of experience running large teams and diversified industry exposure in cloud computing. From shipping lines to rolling stocks.In-depth expertise in driving cloud adoption strategies and modernizing systems to cloud native. Specialized in Microsoft Cloud, DevOps, and Microsoft 365 Stack and conducted numerous successful projects worldwide. Also, Acting as a Technical Advisor for various start-ups.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

× How can I help you?