#!/bin/bash echo "PFX certificate extractor" if [ -z "$1" ]; then echo "Usage: $0 "; exit 1; fi if [ -f "$1" ]; then filename=$(basename "$1") extension="${filename##*.}" filename="${filename%.*}" openssl=$(which openssl) $openssl pkcs12 -in $1 -nocerts -out $filename.pem -nodes $openssl pkcs12 -in $1 -nokeys -out $filename.crt $openssl rsa -in $filename.pem -out $filename.key rm -f $filename.pem fi