aboutsummaryrefslogtreecommitdiff
path: root/openssl/demos/b64.pl
blob: 8aa5fb464d38770bac6becaf46a205dc81287ed0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/local/bin/perl

#
# Make PEM encoded data have lines of 64 bytes of data
#

while (<>)
	{
	if (/^-----BEGIN/ .. /^-----END/)
		{
		if (/^-----BEGIN/) { $first=$_; next; }
		if (/^-----END/) { $last=$_; next; }
		$out.=$_;
		}
	}
$out =~ s/\s//g;
$out =~ s/(.{64})/$1\n/g;
print "$first$out\n$last\n";