Skip to content

Instantly share code, notes, and snippets.

@andrewabest
Created February 10, 2016 03:29
Show Gist options
  • Save andrewabest/b86a32c17484e61b24f9 to your computer and use it in GitHub Desktop.
Save andrewabest/b86a32c17484e61b24f9 to your computer and use it in GitHub Desktop.
Convert a crt + p7b (from godaddy) to pfx
echo off
:: download OpenSSL if you don't have it for the below
:: Conver the p7b into PEM format
openssl pkcs7 -in mydomain.p7b -print_certs -out mydomain.pem
:: Combine this with the crt server certificate and private key into a PFX
openssl pkcs12 -export -in mydomain.crt -inkey mydomain.key -certfile mydomain.pem -out mydomain.pfx
@SBYGIS
Copy link

SBYGIS commented Jan 23, 2018

The current directory you are working in. You can also specify a path like ./path/to/mydomain.crt.

@Nomenator
Copy link

The .key file should be obtainable from the certificate request which you have created for Godaddy.

For that, you will need a Windows Server with IIS installed on it, go to Server Management, select "Internet Information Services" from Tools, and create a certificate request. Then, in Microsoft Management Console you will be able to see this request among the certificates, in the "Certificate Enrolment Requests" group. (How to generate certificate request and export private key)

When you're done with all of this, you will have a certificate request which you can provide to Godaddy to generate your certificate and a private key file which will match this certificate. The key will likely be in .pfx format, and you'll need to convert it into .pem or .key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment