2
0

b64.pl 310 B

1234567891011121314151617181920
  1. #!/usr/local/bin/perl
  2. #
  3. # Make PEM encoded data have lines of 64 bytes of data
  4. #
  5. while (<>)
  6. {
  7. if (/^-----BEGIN/ .. /^-----END/)
  8. {
  9. if (/^-----BEGIN/) { $first=$_; next; }
  10. if (/^-----END/) { $last=$_; next; }
  11. $out.=$_;
  12. }
  13. }
  14. $out =~ s/\s//g;
  15. $out =~ s/(.{64})/$1\n/g;
  16. print "$first$out\n$last\n";