#!/bin/sh # ConvertScript.sh # # This script is designed to take a p7b certificate bundle and convert it to a cer certificate bundle # # Created by David Kittell on 8/8/16. # clear # Variables - Start declare sCerCert="" # Variables - Stop echo "Current Directory: $(pwd)\n" # Ask user for the directory that the p7b cert is in printf "What directory is the p7b cert in?\n" read sCertDirectory # Evaluate the given directory eval dir="$sCertDirectory" sCertDirectory=$(echo $dir | sed "s,/$,,") echo "\nCert Location: $sCertDirectory\n" # Loop through the given directory and convert each p7b file echo "NOTE: Conversion does not remove the P7B file" for filename in $sCertDirectory/*.p7b; do #echo "$filename\n" sCerCert=${filename%.p7b}.cer echo "Converting $filename to $sCerCert" openssl pkcs7 -inform DER -outform PEM -in $filename -print_certs > $sCerCert done
Last Updated on April 2, 2018