diff options
author | Guenter Knauf <lists@gknw.net> | 2013-04-04 00:02:49 +0200 |
---|---|---|
committer | Guenter Knauf <lists@gknw.net> | 2013-04-04 00:02:49 +0200 |
commit | 8efd74de4604ba1114fa191b393f46c7395c8858 (patch) | |
tree | cfb4a330ac4ba7d9e4acce15739c809cf8513c64 /lib/mk-ca-bundle.pl | |
parent | 962eb3d9eda88ec364526b2ad04eda03884bcc9d (diff) | |
download | curl-8efd74de4604ba1114fa191b393f46c7395c8858.tar.gz |
Added option to specify length of base64 output.
Based on a patch posted to the list by Richard Michael.
Diffstat (limited to 'lib/mk-ca-bundle.pl')
-rwxr-xr-x | lib/mk-ca-bundle.pl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/mk-ca-bundle.pl b/lib/mk-ca-bundle.pl index 18dc15690..002723826 100755 --- a/lib/mk-ca-bundle.pl +++ b/lib/mk-ca-bundle.pl @@ -34,15 +34,17 @@ use Getopt::Std; use MIME::Base64; use LWP::UserAgent; use strict; -use vars qw($opt_b $opt_f $opt_h $opt_i $opt_l $opt_n $opt_q $opt_t $opt_u $opt_v); +use vars qw($opt_b $opt_f $opt_h $opt_i $opt_l $opt_n $opt_q $opt_t $opt_u $opt_v $opt_w); my $url = 'http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1'; # If the OpenSSL commandline is not in search path you can configure it here! my $openssl = 'openssl'; -my $version = '1.17'; +my $version = '1.18'; -getopts('bfhilnqtuv'); +$opt_w = 76; # default base64 encoded lines length + +getopts('bfhilnqtuvw:'); if ($opt_i) { print ("=" x 78 . "\n"); @@ -58,7 +60,7 @@ if ($opt_i) { $0 =~ s@.*(/|\\)@@; if ($opt_h) { - printf("Usage:\t%s [-b] [-f] [-i] [-l] [-n] [-q] [-t] [-u] [-v] [<outputfile>]\n", $0); + print "Usage:\t${0} [-b] [-f] [-i] [-l] [-n] [-q] [-t] [-u] [-v] [-w<l>] [<outputfile>]\n"; print "\t-b\tbackup an existing version of ca-bundle.crt\n"; print "\t-f\tforce rebuild even if certdata.txt is current\n"; print "\t-i\tprint version info about used modules\n"; @@ -68,6 +70,7 @@ if ($opt_h) { print "\t-t\tinclude plain text listing of certificates\n"; print "\t-u\tunlink (remove) certdata.txt after processing\n"; print "\t-v\tbe verbose and print out processed CAs\n"; + print "\t-w <l>\twrap base64 output lines after <l> chars (default: ${opt_w})\n"; exit; } @@ -182,8 +185,10 @@ while (<TXT>) { if ($untrusted) { $skipnum ++; } else { + my $encoded = MIME::Base64::encode_base64($data, ''); + $encoded =~ s/(.{1,${opt_w}})/$1\n/g; my $pem = "-----BEGIN CERTIFICATE-----\n" - . MIME::Base64::encode($data) + . $encoded . "-----END CERTIFICATE-----\n"; print CRT "\n$caname\n"; print CRT ("=" x length($caname) . "\n"); |