wok annotate cacerts/stuff/make-cert.pl @ rev 15545

Up: firefox-langpack-ru (17.0.11esr)
author Dominique Corbex <domcox@slitaz.org>
date Sun Nov 24 17:36:40 2013 +0100 (2013-11-24)
parents
children f29d4912ea56
rev   line source
al@14468 1 #!/usr/bin/perl -w
al@14468 2
al@14468 3 # Used to generate PEM encoded files from Mozilla certdata.txt.
al@14468 4 # Run as ./mkcrt.pl > certificate.crt
al@14468 5 #
al@14468 6 # Parts of this script courtesy of RedHat (mkcabundle.pl)
al@14468 7 #
al@14468 8 # This script modified for use with single file data (tempfile.cer) extracted
al@14468 9 # from certdata.txt, taken from the latest version in the Mozilla NSS source.
al@14468 10 # mozilla/security/nss/lib/ckfw/builtins/certdata.txt
al@14468 11 #
al@14468 12 # Authors: DJ Lucas
al@14468 13 # Bruce Dubbs
al@14468 14 #
al@14468 15 # Version 20120211
al@14468 16
al@14468 17 my $certdata = './tempfile.cer';
al@14468 18
al@14468 19 open( IN, "cat $certdata|" )
al@14468 20 || die "could not open $certdata";
al@14468 21
al@14468 22 my $incert = 0;
al@14468 23
al@14468 24 while ( <IN> )
al@14468 25 {
al@14468 26 if ( /^CKA_VALUE MULTILINE_OCTAL/ )
al@14468 27 {
al@14468 28 $incert = 1;
al@14468 29 open( OUT, "|openssl x509 -text -inform DER -fingerprint" )
al@14468 30 || die "could not pipe to openssl x509";
al@14468 31 }
al@14468 32
al@14468 33 elsif ( /^END/ && $incert )
al@14468 34 {
al@14468 35 close( OUT );
al@14468 36 $incert = 0;
al@14468 37 print "\n\n";
al@14468 38 }
al@14468 39
al@14468 40 elsif ($incert)
al@14468 41 {
al@14468 42 my @bs = split( /\\/ );
al@14468 43 foreach my $b (@bs)
al@14468 44 {
al@14468 45 chomp $b;
al@14468 46 printf( OUT "%c", oct($b) ) unless $b eq '';
al@14468 47 }
al@14468 48 }
al@14468 49 }