After reading "Small HowTo on how to import freemail S/MIME certificates into GPGSM" by Matthias Welwarsky [EMAIL PROTECTED], I wrote the following BASH script.
Save it into a file called import-cert.sh, and execute it using the following syntax: bash import-cert.sh myThawteCertExportedFromMozilla.p12 It works with gpgsm 1.9.16 ----------------CUT HERE-------------------- set -e mozCert="$1" basename=$(basename "$mozCert" .p12) dirname=$(dirname "$mozCert") bundle="$dirname/${basename}.pem" key="$dirname/${basename}.privatekey.p12" echo "Converting p12 certificate to pem bundle" openssl pkcs12 -in "$mozCert" -out "$bundle" -nodes echo "Extracting private key from the pem bundle" openssl pkcs12 -in "$bundle" -export -nocerts -nodes -out "$key" echo "Importing private key into gpgsm" gpgsm --import "$key" rm "$key" certCount=0 inCert=0 cat "$bundle" | while read line; do if [ "$(echo "$line" | tr -d "-")" == "BEGIN CERTIFICATE" ]; then certCount=$((certCount + 1)) cert="$dirname/${basename}.cert${certCount}.txt" inCert=1 echo "Extracting certificate #$certCount from the bundle" : > "$cert" fi if [ $inCert == 1 ]; then echo "$line" >> "$cert" fi if [ "$(echo "$line" | tr -d "-")" == "END CERTIFICATE" ]; then inCert=0 echo "Importing certificate #$certCount into gpgsm" gpgsm --import "$cert" rm "$cert" fi done rm "$bundle" ----------------CUT HERE-------------------- -- Nick _______________________________________________ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users