1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#!/bin/bash mypass='Password' # one password for each PFX file pfx=( 'domain1.pfx' 'domain2.pfx' 'domain3.pfx' ) for ((x = 0; x < ${#pfx[@]}; x++)) do echo "Exporting ${pfx[$x]}..." openssl pkcs12 -in ${pfx[$x]} -clcerts -nokeys -out ${pfx[$x]}.cer -passin pass:$mypass openssl pkcs12 -in ${pfx[$x]} -nocerts -nodes -out ${pfx[$x]}.enc.key -passin pass:$mypass openssl rsa -in ${pfx[$x]}.enc.key -out ${pfx[$x]}.key rm -f ${pfx[$x]}.enc.key echo "Done!" done |