Revision 63e1319d0fda2eb0d37e107ac58252f0d3dd0985 authored by Dr. Stephen Henson on 16 September 2008, 15:14:55 UTC, committed by Dr. Stephen Henson on 16 September 2008, 15:14:55 UTC
1 parent 8067d34
Raw File
b64.pl
#!/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";


back to top