Skip to content

Instantly share code, notes, and snippets.

@frgomes
Last active July 1, 2019 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frgomes/0d0643499b7fbb2b26d10fe755da9cb2 to your computer and use it in GitHub Desktop.
Save frgomes/0d0643499b7fbb2b26d10fe755da9cb2 to your computer and use it in GitHub Desktop.
openssl - Convert from .PFX to CRT, CER, root PEM and client PEM
#!/bin/bash
# This lists the contents of a PFX file
# This is the last resort in case everything else fails.
# Just see its contents as a text file, cut whatever you need from it and
# paste manually onto separate files.
openssl pkcs12 -info -in input.pfx
# Found this in the internet. Not tested at all!
openssl pkcs12 -in input.pfx -out mycerts.crt -nokeys -clcerts
openssl x509 -in mycerts.crt -inform pem -outform der -out mycerts.cer
openssl pkcs12 -in input.pfx -out client_ssl.pem -clcerts
openssl pkcs12 -in input.pfx -out root.pem -cacerts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment