Skip to content

Instantly share code, notes, and snippets.

@Oceanswave
Last active March 1, 2018 08:56
Show Gist options
  • Save Oceanswave/eb310e022cea56ccfe95 to your computer and use it in GitHub Desktop.
Save Oceanswave/eb310e022cea56ccfe95 to your computer and use it in GitHub Desktop.
Extract data from pfx for AWS Api Gateway
Get OpenSSL:
https://www.openssl.org/related/binaries.html
Procedure
create an CSR, submit it to a CA, Get the CER back, Import into MMC -> Certificates Snapin, Export with private key.
Take the file you exported (e.g. certname.pfx) and copy it to a system where you have OpenSSL installed. Note: the *.pfx file is in PKCS#12 format and includes both the certificate and the private key.
Certificate Body:
Run the following command to export the certificate: openssl pkcs12 -in certname.pfx -nokeys -clcerts -out name.pem
Certificate Private Key:
Run the following command to export the private key: openssl pkcs12 -in certname.pfx -nocerts -nodes -out name.unencrypted.priv.key
Certificate Chain:
Run the following command to export the certificate chain: openssl pkcs12 -in certname.pfx -nokeys -cacerts -out CAchain.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment