File: b64.pl

package info (click to toggle)
openssl 0.9.8o-4squeeze14
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 25,724 kB
  • ctags: 33,381
  • sloc: ansic: 233,772; perl: 23,990; makefile: 13,204; asm: 9,276; cpp: 4,379; sh: 3,194; lisp: 24
file content (20 lines) | stat: -rw-r--r-- 304 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/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";