Pastebin

Paste #986: pkcs12-cutter

< previous paste - next paste>

Pasted by Flawless

Download View as text

#!/usr/bin/perl -W

use strict;

sub usage {
  print "$0 <cert file.html> <output.p12>"
}

$#ARGV == 1 or usage;

open HTML, $ARGV[0];
while (<HTML>) {
    if (/^pkcs12="(.*)";/) {
        $_ = $1;
        s/(.{64})/$1\n/g;
        open OPENSSL, "| openssl base64 -d -out $ARGV[1]";
        print OPENSSL $_;
        close OPENSSL;
    }
}
close HTML;

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.