Skip to main content

How to extract the certificate and keys from a .pfx file

INTRODUCTION

A Personal Information Exchange (. pfx) Files, is password protected file certificate commonly used for code signing your application. It derives from the PKCS 12 archive file format certificate, and it stores multiple cryptographic objects within a single file: X. 509 public key certificates. In this tutorial, we will learn how to extract the certificate and keys from a .pfx in Windows Servers.

Prerequisites

Step 1. Open the command prompt and go to the folder that contains your .pfx file.

Step 2. Run the following command to extract the private key:

openssl pkcs12 -in [yourfile.pfx] -nocerts -out [drlive.key]

Step 3. Run the following command to extract the certificate:

openssl pkcs12 -in [yourfile.pfx] -clcerts -nokeys -out [drlive.crt]

Step 4. Run the following command to decrypt the private key:

openssl rsa -in [drlive.key] -out [drlive-decrypted.key]

Thank You!