#!/usr/bin/perl -W use strict; sub usage { print "$0 " } $#ARGV == 1 or usage; open HTML, $ARGV[0]; while () { if (/^pkcs12="(.*)";/) { $_ = $1; s/(.{64})/$1\n/g; open OPENSSL, "| openssl base64 -d -out $ARGV[1]"; print OPENSSL $_; close OPENSSL; } } close HTML;