michael@3: #!/usr/bin/perl -w michael@3: # michael@3: # Used to regenerate ca-bundle.crt from the Mozilla certdata.txt. michael@3: # Run as ./mkcabundle.pl > ca-bundle.crt michael@3: # michael@3: michael@3: my $cvsroot = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot'; michael@3: my $certdata = 'mozilla/security/nss/lib/ckfw/builtins/certdata.txt'; michael@3: michael@3: open(IN, "cvs -d $cvsroot co -p $certdata|") michael@3: || die "could not check out certdata.txt"; michael@3: michael@3: my $incert = 0; michael@3: michael@3: print<) { michael@3: if (/^CKA_VALUE MULTILINE_OCTAL/) { michael@3: $incert = 1; michael@3: open(OUT, "|openssl x509 -text -inform DER -fingerprint") michael@3: || die "could not pipe to openssl x509"; michael@3: } elsif (/^END/ && $incert) { michael@3: close(OUT); michael@3: $incert = 0; michael@3: print "\n\n"; michael@3: } elsif ($incert) { michael@3: my @bs = split(/\\/); michael@3: foreach my $b (@bs) { michael@3: chomp $b; michael@3: printf(OUT "%c", oct($b)) unless $b eq ''; michael@3: } michael@3: } elsif (/^CVS_ID.*Revision: ([^ ]*).*/) { michael@3: print "# Generated from certdata.txt RCS revision $1\n#\n"; michael@3: } michael@3: }