Skip to content

Commit

Permalink
New template toolkit method Utils.to_base64
Browse files Browse the repository at this point in the history
  • Loading branch information
oliwel committed Jan 15, 2021
1 parent 9aa5e00 commit 57279cd
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion core/server/OpenXPKI/Template/Plugin/Utils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use utf8;
use Moose;
use Net::DNS;
use Template::Plugin;

use MIME::Base64;
use Data::Dumper;

extends 'Template::Plugin';
Expand Down Expand Up @@ -70,5 +70,18 @@ sub ascii_to_hex {

}

=head3 to_base64 ( text )
Encode the given (binary) data using Base64 encoding, output is without
linebreaks or spaces.
=cut

sub to_base64 {

my $self = shift;
my $string = shift;
return MIME::Base64::encode_base64($string, '');
}

1;

0 comments on commit 57279cd

Please sign in to comment.