Crypt-Util
view release on metacpan or search on metacpan
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
name: Crypt-Util
no_index:
directory:
- inc
- t
recommends:
Crypt::Blowfish: 0
Crypt::CBC: 0
Crypt::CFB: 0
Crypt::DES: 0
Crypt::EAX: 0.04
Crypt::RC6: 0
Crypt::RIPEMD160: 0
Crypt::Rijndael: 0
Crypt::Serpent: 0
Crypt::Twofish: 0
Digest::CMAC: 0
Digest::HMAC: 0
Makefile.PL view on Meta::CPAN
build_requires 'Test::More' => 0;
build_requires 'Test::use::ok' => 0;
build_requires 'Test::Exception' => 0;
recommends 'MIME::Base64' => 0;
recommends 'MIME::Base64::URLSafe' => 0;
recommends 'MIME::Base32' => 0;
recommends 'URI::Escape' => 0;
recommends 'Crypt::CFB' => 0; # stream ciphers
recommends 'Crypt::CBC' => 0; # block ciphers
recommends 'Crypt::EAX' => '0.04'; # AEAD mode
recommends 'Crypt::Rijndael' => 0; # AES
recommends 'Crypt::Serpent' => 0; # AES finalist
recommends 'Crypt::Twofish' => 0; # AES finalist
recommends 'Crypt::RC6' => 0; # AES finalist
recommends 'Crypt::Blowfish' => 0; # still widely in use
recommends 'Crypt::DES' => 0; # still widely in use
lib/Crypt/Util.pm view on Meta::CPAN
my %exports = map { $_ => \&__curry_instance } map { @$_ } values %export_groups;
Sub::Exporter->import( -setup => {
exports => \%exports,
groups => \%export_groups,
collectors => {
defaults => sub { 1 },
},
});
our @KNOWN_AUTHENTICATING_MODES = qw(EAX OCB GCM CWC CCM); # IACBC & IAPM will probably never be implemented
our %KNOWN_AUTHENTICATING_MODES = map { $_ => 1 } @KNOWN_AUTHENTICATING_MODES;
our %FALLBACK_LISTS = (
mode => [qw/CFB CBC Ctr OFB/],
stream_mode => [qw/CFB Ctr OFB/],
block_mode => [qw/CBC/],
authenticated_mode => [qw/EAX GCM CCM/], # OCB/], OCB is patented
cipher => [qw/Rijndael Serpent Twofish RC6 Blowfish RC5/],
#authenticated_cipher => [qw/Phelix SOBER-128 Helix/], # not yet ready
digest => [qw/SHA-1 SHA-256 RIPEMD160 Whirlpool MD5 Haval256/],
mac => [qw/HMAC CMAC/],
encoding => [qw/hex/],
printable_encoding => [qw/base64 hex/],
alphanumerical_encoding => [qw/base32 hex/],
uri_encoding => [qw/uri_base64 base32 hex/],
);
lib/Crypt/Util.pm view on Meta::CPAN
key => $self->process_key(%params),
nonce => $params{nonce},
);
}
sub cipher_object_cbc {
my ( $self, %params ) = _args @_;
$self->_process_params( \%params, qw/cipher/ );
require Crypt::CBC;
Crypt::CBC->new(
-cipher => $params{cipher},
-key => $self->process_key(%params),
);
}
sub cipher_object_ofb {
my ( $self, %params ) = _args @_;
$self->_process_params( \%params, qw/cipher/ );
lib/Crypt/Util.pm view on Meta::CPAN
This module is designed to have an easy API to allow easy but responsible
use of the more low level Crypt:: and Digest:: modules on CPAN. Therefore,
patches to improve ease-of-use are very welcome.
=item Pluggability
Dependency hell is avoided using a fallback mechanism that tries to choose an
algorithm based on an overridable list.
For "simple" use install Crypt::Util and your favourite digest, cipher and
cipher mode (CBC, CFB, etc).
To ensure predictable behavior the fallback behavior can be disabled as necessary.
=back
=head2 Interoperability
To ensure that your hashes and strings are compatible with L<Crypt::Util>
deployments on other machines (where different Crypt/Digest modules are
available, etc) you should use C<disable_fallback>.
lib/Crypt/Util.pm view on Meta::CPAN
The fallback list is
C<Rijndael>, C<Serpent>, C<Twofish>, C<RC6>, C<Blowfish> and C<RC5>.
L<Crypt::Rijndael> is the AES winner, the next three are AES finalists, and the
last two are well known and widely used.
=item * mode
The mode in which to use the cipher.
The fallback list is C<CFB>, C<CBC>, C<Ctr>, and C<OFB>.
=item digest
The fallback list is C<SHA-1>, C<SHA-256>, C<RIPEMD160>,
C<Whirlpool>, C<MD5>, and C<Haval256>.
=item * encoding
The fallback list is C<hex> (effectively no fallback).
lib/Crypt/Util.pm view on Meta::CPAN
=item *
Additional data formats (streams/iterators, filehandles, generalized storable
data/string handling for all methods, not just tamper_proof).
Streams should also be able to used via a simple push api.
=item *
IV/nonce/salt support for the various cipher modes, not just EAX (CBC, CCM, GCM, etc)
=item *
L<Crypt::Rijndael> can do its own cipher modes
=head1 SEE ALSO
L<Digest>, L<Crypt::CBC>, L<Crypt::CFB>,
L<http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation>.
=head1 VERSION CONTROL
This module is maintained using Darcs. You can get the latest version from
L<http://nothingmuch.woobling.org/Crypt-Util/>, and use C<darcs send> to commit
changes.
=head1 AUTHORS
lib/Crypt/Util.pmc view on Meta::CPAN
my %exports = map { $_ => \&__curry_instance } map { @$_ } values %export_groups;
Sub::Exporter->import( -setup => {
exports => \%exports,
groups => \%export_groups,
collectors => {
defaults => sub { 1 },
},
});
our @KNOWN_AUTHENTICATING_MODES = qw(EAX OCB GCM CWC CCM); # IACBC & IAPM will probably never be implemented
our %KNOWN_AUTHENTICATING_MODES = map { $_ => 1 } @KNOWN_AUTHENTICATING_MODES;
our %FALLBACK_LISTS = (
mode => [qw/CFB CBC Ctr OFB/],
stream_mode => [qw/CFB Ctr OFB/],
block_mode => [qw/CBC/],
authenticated_mode => [qw/EAX GCM CCM/], # OCB/], OCB is patented
cipher => [qw/Rijndael Serpent Twofish RC6 Blowfish RC5/],
# fa884d2582f6f05a5ffc6634115076027e7e91e1
digest => [qw/SHA-1 SHA-256 RIPEMD160 Whirlpool MD5 Haval256/],
mac => [qw/HMAC CMAC/],
encoding => [qw/hex/],
printable_encoding => [qw/base64 hex/],
alphanumerical_encoding => [qw/base32 hex/],
uri_encoding => [qw/uri_base64 base32 hex/],
);
lib/Crypt/Util.pmc view on Meta::CPAN
key => $self->process_key(%params),
nonce => $params{nonce},
);
}
sub cipher_object_cbc {
my ( $self, %params ) = _args @_;
$self->_process_params( \%params, qw/cipher/ );
require Crypt::CBC;
Crypt::CBC->new(
-cipher => $params{cipher},
-key => $self->process_key(%params),
);
}
sub cipher_object_ofb {
my ( $self, %params ) = _args @_;
$self->_process_params( \%params, qw/cipher/ );
lib/Crypt/Util.pmc view on Meta::CPAN
This module is designed to have an easy API to allow easy but responsible
use of the more low level Crypt:: and Digest:: modules on CPAN. Therefore,
patches to improve ease-of-use are very welcome.
=item Pluggability
Dependency hell is avoided using a fallback mechanism that tries to choose an
algorithm based on an overridable list.
For "simple" use install Crypt::Util and your favourite digest, cipher and
cipher mode (CBC, CFB, etc).
To ensure predictable behavior the fallback behavior can be disabled as necessary.
=back
=head2 Interoperability
To ensure that your hashes and strings are compatible with L<Crypt::Util>
deployments on other machines (where different Crypt/Digest modules are
available, etc) you should use C<disable_fallback>.
lib/Crypt/Util.pmc view on Meta::CPAN
The fallback list is
C<Rijndael>, C<Serpent>, C<Twofish>, C<RC6>, C<Blowfish> and C<RC5>.
L<Crypt::Rijndael> is the AES winner, the next three are AES finalists, and the
last two are well known and widely used.
=item * mode
The mode in which to use the cipher.
The fallback list is C<CFB>, C<CBC>, C<Ctr>, and C<OFB>.
=item digest
The fallback list is C<SHA-1>, C<SHA-256>, C<RIPEMD160>,
C<Whirlpool>, C<MD5>, and C<Haval256>.
=item * encoding
The fallback list is C<hex> (effectively no fallback).
lib/Crypt/Util.pmc view on Meta::CPAN
=item *
Additional data formats (streams/iterators, filehandles, generalized storable
data/string handling for all methods, not just tamper_proof).
Streams should also be able to used via a simple push api.
=item *
IV/nonce/salt support for the various cipher modes, not just EAX (CBC, CCM, GCM, etc)
=item *
L<Crypt::Rijndael> can do its own cipher modes
=head1 SEE ALSO
L<Digest>, L<Crypt::CBC>, L<Crypt::CFB>,
L<http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation>.
=head1 VERSION CONTROL
This module is maintained using Darcs. You can get the latest version from
L<http://nothingmuch.woobling.org/Crypt-Util/>, and use C<darcs send> to commit
changes.
=head1 AUTHORS
t/encrypt.t view on Meta::CPAN
cmp_ok( $key, "ne", "foo", "it's a digest of some sort" );
is( $c->process_key("foo", literal_key => 1), "foo", "literal key");
$c->default_use_literal_key(1);
is( $c->process_key("foo"), "foo", "literal key from defaults" );
$c->default_use_literal_key(0);
foreach my $mode ( qw/stream block CBC CFB OFB Ctr/ ) {
SKIP: {
skip "$mode not installed ($@)", 1 unless eval { $c->cipher_object( mode => $mode, key => "futz" ) };
my $ciphertext = $c->encrypt_string(
key => "moose",
string => "dancing",
mode => $mode,
);
is(
( run in 0.868 second using v1.01-cache-2.11-cpan-e1769b4cff6 )