Skip to content

Instantly share code, notes, and snippets.

@mintsoft
Last active October 24, 2016 07:21
Show Gist options
  • Save mintsoft/5561156 to your computer and use it in GitHub Desktop.
Save mintsoft/5561156 to your computer and use it in GitHub Desktop.
Wrapper around openssl for converting pkcs12 certificates exported out of IIS into unencrypted x509 for Apache
#!/bin/bash
[[ -z "$1" ]] && echo "Please specify a .pfx file!" && exit 1;
#combined format:
openssl pkcs12 -in "$1" -out "${1%.pfx}.key_cert.pem" -nodes
#extract certificate/public key
openssl x509 -in "${1%.pfx}.key_cert.pem" -out "${1%.pfx}.cert"
#extract private key
openssl rsa -in "${1%.pfx}.key_cert.pem" -out "${1%.pfx}.key"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment