NAME

Mojolicious::Plugin::Crypto - Provide interface to symmetric cipher algorithms (AES and Blowfish)

SYNOPSIS

use Mojolicious::Plugin::Crypt;

my $fix_key = 'secretpassphrase';
my $plain = "NemuxMojoCrypt";

#... 
# You can leave key value empty and it will generate a new key for you

my ($crypted, $key)  = $t->app->crypt_aes($plain, $fix_key);

#... [ store this crypted data where do you want ... ]

# and decrypt it
my $clean =  $t->app->decrypt_aes($crypted, $key);
 

DESCRIPTION

You can use this plugin in order to encrypt and decrypt value using one of these two symmetric algorithms: AES or Blowfish

USAGE

#!/usr/bin/env perl

### DUMMY example below and... All the glory to the Hypnotoad use Mojolicious::Lite; plugin 'Crypto';

my $bigsecret = "MyNameisMarcoRomano";

### You can test in this way # /aes/enc?data=nemux # /aes/dec?data=53616c7465645f5f6355829a809369eee5dfb9489eaee7e190b67d15d2e35ce8

# /blowfish/enc?data=nemux # /blowfish/dec?data=53616c7465645f5f16d8c8aa479121d039b04703083a9391

get '/aes/enc' => sub { my $self = shift; my $data = $self->param('data'); my ($securedata) = $self->crypt_aes($data, $bigsecret); $self->render(text => $securedata); };

get '/aes/dec' => sub { my $self = shift; my $data = $self->param('data'); my ($plaintext) = $self->decrypt_aes($data, $bigsecret); $self->render(text => $plaintext); };

get '/blowfish/enc' => sub { my $self = shift; my $data = $self->param('data'); my ($securedata) = $self->crypt_blowfish($data, $bigsecret); $self->render(text => $securedata); };

get '/blowfish/dec' => sub { my $self = shift; my $data = $self->param('data'); my ($plaintext) = $self->decrypt_blowfish($data, $bigsecret); $self->render(text => $plaintext); };

app->start;

BUGS

No bugs for now... but there are more features to add in the future. Probably...

SUPPORT

Write me if you need some help and feel free to improve it. You can find me on irc freenode sometimes.

AUTHOR

Marco Romano
CPAN ID: NEMUX
Mojolicious CryptO Plugin
nemux@cpan.org
http://search.cpan.org/~nemux/

COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.

SEE ALSO

perl(1).