wok-6.x view cacerts/stuff/make-cert.pl @ rev 14637

Xorg: add xorg-libXScrnSaver(-dev); reformat receipts and add licenses: xorg-libFS* xorg-libICE* xorg-libSM* xorg-libXext* xorg-libXmu* xorg-libXt*
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Jun 02 12:47:38 2013 +0000 (2013-06-02)
parents
children f29d4912ea56
line source
1 #!/usr/bin/perl -w
3 # Used to generate PEM encoded files from Mozilla certdata.txt.
4 # Run as ./mkcrt.pl > certificate.crt
5 #
6 # Parts of this script courtesy of RedHat (mkcabundle.pl)
7 #
8 # This script modified for use with single file data (tempfile.cer) extracted
9 # from certdata.txt, taken from the latest version in the Mozilla NSS source.
10 # mozilla/security/nss/lib/ckfw/builtins/certdata.txt
11 #
12 # Authors: DJ Lucas
13 # Bruce Dubbs
14 #
15 # Version 20120211
17 my $certdata = './tempfile.cer';
19 open( IN, "cat $certdata|" )
20 || die "could not open $certdata";
22 my $incert = 0;
24 while ( <IN> )
25 {
26 if ( /^CKA_VALUE MULTILINE_OCTAL/ )
27 {
28 $incert = 1;
29 open( OUT, "|openssl x509 -text -inform DER -fingerprint" )
30 || die "could not pipe to openssl x509";
31 }
33 elsif ( /^END/ && $incert )
34 {
35 close( OUT );
36 $incert = 0;
37 print "\n\n";
38 }
40 elsif ($incert)
41 {
42 my @bs = split( /\\/ );
43 foreach my $b (@bs)
44 {
45 chomp $b;
46 printf( OUT "%c", oct($b) ) unless $b eq '';
47 }
48 }
49 }