#!/bin/bash set -e usage() { cat < Transforms a .p12 file, for instance as exported by Firefox's cerfiticate "backup" feature, into a PEM file that contains your private key and certificate. To export your certificate from Firefox, go to Edit|Preferences, Advanced|Security|View Certificates, and ``Backup'' your certificate to a file. Firefox will save it as a PKCS12 certificate. You must enter a passphrase, which this script will prompt you for. EOF exit 1 } [ "$#" -eq 2 ] || usage pkcs="$1" pem="$2" openssl pkcs12 -in "$pkcs" -nodes -out "$pem" cat >&2 <