Egg-Plugin-Crypt-CBC
view release on metacpan or search on metacpan
Revision history for Perl extension Egg::Plugin::Crypt::CBC.
3.01 2008/04/17
- Build.PL is abolished.
3.00 2008/02/24
- Corresponded to Egg::Release v3.00.
2.00 2007/05/03
- Corresponded to Egg::Release v2.00.
0.04 2007/03/25
- Maintenance release for Pod coverage.
0.03 2007/03/02
- It improved to CPAN.
0.01 Sat Dec 23 08:52:23 2006 GMT
- original version; created by Egg::Helper::PerlModuleMaker v0.02 with
module name Egg-Plugin-Crypt-CBC
inc/Module/Install/Fetch.pm
inc/Module/Install/Include.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
inc/Test/More.pm
inc/Test/Perl/Critic.pm
inc/Test/Pod.pm
inc/Test/Pod/Coverage.pm
lib/Egg/Plugin/Crypt/CBC.pm
Makefile.PL
MANIFEST This list of files
META.yml
README
t/00_use.t
t/01_cbc.t
t/89_pod.t
t/98_perlcritic.t
t/99_pod_coverage.t
---
name: Egg-Plugin-Crypt-CBC
version: 3.00
author:
- 'Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>'
abstract: lib/Egg/Plugin/Crypt/CBC.pm
license: perl
resources:
license: http://dev.perl.org/licenses/
requires:
Crypt::Blowfish: 2.1
Crypt::CBC: 2.22
Crypt::Camellia: 2.01
Crypt::DES: 2.05
Crypt::Rabbit: 1
Crypt::Twofish2: 1.01
Egg::Release: 2
Test::More: 0
Test::Perl::Critic: 0
Test::Pod: 0
Test::Pod::Coverage: 0
provides:
Egg::Plugin::Crypt::CBC:
file: lib/Egg/Plugin/Crypt/CBC.pm
version: 3.00
Egg::Plugin::Crypt::CBC::handler:
file: lib/Egg/Plugin/Crypt/CBC.pm
generated_by: Module::Build version 0.2808
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.2.html
version: 1.2
Makefile.PL view on Meta::CPAN
use inc::Module::Install;
name 'Egg-Plugin-Crypt-CBC';
all_from 'lib/Egg/Plugin/Crypt/CBC.pm';
version_from 'lib/Egg/Plugin/Crypt/CBC.pm';
abstract_from 'lib/Egg/Plugin/Crypt/CBC.pm';
author 'Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>';
license 'perl';
requires 'Egg::Release' => 2.00;
requires 'Crypt::CBC' => 2.22;
requires 'Crypt::Blowfish' => 2.10;
requires 'Crypt::DES' => 2.05;
requires 'Crypt::Camellia' => 2.01;
requires 'Crypt::Rabbit' => 1.00;
requires 'Crypt::Twofish2' => 1.01;
build_requires 'Test::More';
build_requires 'Test::Pod';
build_requires 'Test::Perl::Critic';
build_requires 'Test::Pod::Coverage';
Egg-Plugin-Crypt-CBC.
=================================================
The README is used to introduce the module and provide instructions on
how to install the module, any machine dependencies it may have (for
example C compilers and installed libraries) and any other information
that should be provided before the module is installed.
A README file is required for CPAN modules since CPAN extracts the
README file from a module distribution so that people browsing the
archive can use it get an idea of the modules uses. It is usually a
eg/Example/lib/Example.pm view on Meta::CPAN
package Example;
use strict;
use warnings;
use Egg qw/ -Debug
Crypt::CBC
Dispatch::Fast
Debugging
Log
/;
our $VERSION= '0.01';
__PACKAGE__->egg_startup(
title => 'Example',
lib/Egg/Plugin/Crypt/CBC.pm view on Meta::CPAN
package Egg::Plugin::Crypt::CBC;
#
# Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
#
# $Id: CBC.pm 318 2008-04-17 12:17:01Z lushe $
#
use strict;
use warnings;
our $VERSION = '3.01';
sub _setup {
my($e)= @_;
my $conf= $e->config->{plugin_crypt_cbc} ||= {};
lib/Egg/Plugin/Crypt/CBC.pm view on Meta::CPAN
$conf->{key} || die q{ Please setup 'plugin_crypt_cbc->{key}'. };
$conf->{iv} ||= '$KJh#(}q';
$conf->{padding} ||= 'standard';
$conf->{prepend_iv}= 0 unless exists($conf->{prepend_iv});
$conf->{regenerate_key}= 1 unless exists($conf->{regenerate_key});
$e->next::method;
}
sub cbc {
my $e= shift;
@_ ? ($e->{crypt_cbc}= Egg::Plugin::Crypt::CBC::handler->new($e, @_))
: ($e->{crypt_cbc} ||= Egg::Plugin::Crypt::CBC::handler->new($e))
}
package Egg::Plugin::Crypt::CBC::handler;
use strict;
use warnings;
use MIME::Base64;
use base qw/Crypt::CBC/;
sub new {
my($class, $e)= splice @_, 0, 2;
my %option= (
%{$e->config->{plugin_crypt_cbc}},
%{ $_[1] ? {@_}: ($_[0] || {}) },
);
$class->SUPER::new(\%option);
}
sub encode {
lib/Egg/Plugin/Crypt/CBC.pm view on Meta::CPAN
my $crypt= shift || return "";
$self->decrypt( decode_base64($crypt) ) || "";
}
1;
__END__
=head1 NAME
Egg::Plugin::Crypt::CBC - Crypt::CBC for Egg Plugin.
=head1 SYNOPSIS
use Egg qw/ Crypt::CBC /;
__PACKAGE__->egg_startup(
.....
...
plugin_crypt_cbc => {
cipher=> 'Blowfish',
key => 'uniqueid',
...
},
lib/Egg/Plugin/Crypt/CBC.pm view on Meta::CPAN
my $crypt= $e->cbc->encode($text);
# The code end text is decrypted.
my $plain= $e->cbc->decode($crypt);
# The cbc object is acquired in an arbitrary option.
my $cbc= $e->cbc( cipher => 'DES' );
=head1 DESCRIPTION
It is a plugin to use the code and decoding by L<Crypt::CBC>.
=head1 CONFIGURATION
HASH is defined in 'plugin_crypt_cbc' key and it sets it.
The setting is an option to pass everything to L<Crypt::CBC>.
Please refer to the document of L<Crypt::CBC> for details.
=head2 cipher
The exception is generated in case of undefined.
=head2 key
The exception is generated in case of undefined.
=head2 iv
lib/Egg/Plugin/Crypt/CBC.pm view on Meta::CPAN
=head2 cbc ( [OPTION_HASH] )
The handler object of this plugin is returned.
It turns by using the same object when the object is generated once usually.
When OPTION_HASH is given, it tries to generate the object newly.
=head1 HANDLER METHODS
The handler object has succeeded to L<Crypt::CBC>.
=head1 new
Constructor.
=head1 encode ( [PLAIN_TEXT] )
After PLAIN_TEXT is encrypted, the Base64 encode text is returned.
my $crypt_text= $e->cbc->encode( 'plain text' );
=head1 decode ( [CRYPT_TEXT] )
The text encrypted by 'encode' method is made to the compound and returned.
my $plain_text= $e->cbc->decode( 'crypt text' );
=head1 SEE ALSO
L<Egg::Release>,
L<Crypt::CBC>,
=head1 AUTHOR
Masatoshi Mizuno E<lt>lusheE<64>cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2008 Bee Flag, Corp. E<lt>L<http://egg.bomcity.com/>E<gt>, All Rights Reserved.
This library is free software; you can redistribute it and/or modify
use Test::More tests => 1;
BEGIN { use_ok('Egg::Plugin::Crypt::CBC') };
: Crypt::Camellia->require ? 'Camellia'
: Crypt::Rabbit->require ? 'Rabbit'
: Crypt::Twofish2->require ? 'Twofish2'
: return do {
plan skip_all=> "The Ciper module is not installed.";
};
plan tests=> 10;
ok my $e= Egg::Helper->run( Vtest => {
vtest_plugins=> [qw/ Crypt::CBC /],
vtest_config=> {
plugin_crypt_cbc=> {
cipher => $ciper,
key => '(abcdef)',
},
},
});
my $plain_text= 'secret text';
( run in 0.672 second using v1.01-cache-2.11-cpan-e1769b4cff6 )