wok diff cacerts/stuff/make-cert.pl @ rev 15600

Add some licenses
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Dec 05 15:25:09 2013 +0000 (2013-12-05)
parents
children f29d4912ea56
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/cacerts/stuff/make-cert.pl	Thu Dec 05 15:25:09 2013 +0000
     1.3 @@ -0,0 +1,49 @@
     1.4 +#!/usr/bin/perl -w
     1.5 +
     1.6 +# Used to generate PEM encoded files from Mozilla certdata.txt.
     1.7 +# Run as ./mkcrt.pl > certificate.crt
     1.8 +#
     1.9 +# Parts of this script courtesy of RedHat (mkcabundle.pl)
    1.10 +#
    1.11 +# This script modified for use with single file data (tempfile.cer) extracted
    1.12 +# from certdata.txt, taken from the latest version in the Mozilla NSS source.
    1.13 +# mozilla/security/nss/lib/ckfw/builtins/certdata.txt
    1.14 +#
    1.15 +# Authors: DJ Lucas
    1.16 +#          Bruce Dubbs
    1.17 +#
    1.18 +# Version 20120211
    1.19 +
    1.20 +my $certdata = './tempfile.cer';
    1.21 +
    1.22 +open( IN, "cat $certdata|" )
    1.23 +    || die "could not open $certdata";
    1.24 +
    1.25 +my $incert = 0;
    1.26 +
    1.27 +while ( <IN> )
    1.28 +{
    1.29 +    if ( /^CKA_VALUE MULTILINE_OCTAL/ )
    1.30 +    {
    1.31 +        $incert = 1;
    1.32 +        open( OUT, "|openssl x509 -text -inform DER -fingerprint" )
    1.33 +            || die "could not pipe to openssl x509";
    1.34 +    }
    1.35 +
    1.36 +    elsif ( /^END/ && $incert )
    1.37 +    {
    1.38 +        close( OUT );
    1.39 +        $incert = 0;
    1.40 +        print "\n\n";
    1.41 +    }
    1.42 +
    1.43 +    elsif ($incert)
    1.44 +    {
    1.45 +        my @bs = split( /\\/ );
    1.46 +        foreach my $b (@bs)
    1.47 +        {
    1.48 +            chomp $b;
    1.49 +            printf( OUT "%c", oct($b) ) unless $b eq '';
    1.50 +        }
    1.51 +    }
    1.52 +}