Crypt-Mode-CBC-Easy

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

Revision history for Crypt::Mode::CBC::Easy

0.006     2019-10-05 15:59:52-05:00 America/Chicago
    Auto generate minimum perl version using [MinimumPerlFast]. (@manwar)

0.005     2019-10-04 14:39:21-05:00 America/Chicago
    Auto generate META.json using the plugin [MetaJSON]. (@manwar)

0.004     2017-01-05 20:48:23-08:00 America/Los_Angeles
    Cleaned up decrypt code.

MANIFEST  view on Meta::CPAN

# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012.
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
README.md
dist.ini
lib/Crypt/Mode/CBC/Easy.pm

META.json  view on Meta::CPAN

   ],
   "dynamic_config" : 0,
   "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : 2
   },
   "name" : "Crypt-Mode-CBC-Easy",
   "prereqs" : {
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Bytes::Random::Secure" : "0",
            "Carp" : "0",
            "Crypt::CBC" : "0",
            "Crypt::Mode::CBC" : "0",
            "Digest::SHA" : "0",
            "MIME::Base64" : "0",
            "Mouse" : "0",
            "perl" : "5.008",
            "strict" : "0"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "bugtracker" : {
         "web" : "https://github.com/srchulo/Crypt-Mode-CBC-Easy/issues"
      }
   },
   "version" : "0.006",
   "x_generated_by_perl" : "v5.30.0",
   "x_serialization_backend" : "Cpanel::JSON::XS version 4.12"
}

META.yml  view on Meta::CPAN

  - 'Adam Hopkins <srchulo@cpan.org>'
build_requires: {}
configure_requires:
  ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'
name: Crypt-Mode-CBC-Easy
requires:
  Bytes::Random::Secure: '0'
  Carp: '0'
  Crypt::CBC: '0'
  Crypt::Mode::CBC: '0'
  Digest::SHA: '0'
  MIME::Base64: '0'
  Mouse: '0'
  perl: '5.008'
  strict: '0'
resources:
  bugtracker: https://github.com/srchulo/Crypt-Mode-CBC-Easy/issues
version: '0.006'
x_generated_by_perl: v5.30.0
x_serialization_backend: 'YAML::Tiny version 1.73'

Makefile.PL  view on Meta::CPAN

use 5.008;

use ExtUtils::MakeMaker;

my %WriteMakefileArgs = (
  "ABSTRACT" => "Encrypts/decrypts text and verifies decrypted text with a checksum and a random initialization vector.",
  "AUTHOR" => "Adam Hopkins <srchulo\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "Crypt-Mode-CBC-Easy",
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.008",
  "NAME" => "Crypt::Mode::CBC::Easy",
  "PREREQ_PM" => {
    "Bytes::Random::Secure" => 0,
    "Carp" => 0,
    "Crypt::CBC" => 0,
    "Crypt::Mode::CBC" => 0,
    "Digest::SHA" => 0,
    "MIME::Base64" => 0,
    "Mouse" => 0,
    "strict" => 0
  },
  "VERSION" => "0.006",
  "test" => {
    "TESTS" => ""
  }
);


my %FallbackPrereqs = (
  "Bytes::Random::Secure" => 0,
  "Carp" => 0,
  "Crypt::CBC" => 0,
  "Crypt::Mode::CBC" => 0,
  "Digest::SHA" => 0,
  "MIME::Base64" => 0,
  "Mouse" => 0,
  "strict" => 0
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};

README  view on Meta::CPAN

This archive contains the distribution Crypt-Mode-CBC-Easy,
version 0.006:

  Encrypts/decrypts text and verifies decrypted text with a checksum and a random initialization vector.

This software is copyright (c) 2017 by Adam Hopkins.

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


README.md  view on Meta::CPAN

# Crypt-Mode-CBC-Easy

dist.ini  view on Meta::CPAN

name    = Crypt-Mode-CBC-Easy
author  = Adam Hopkins <srchulo@cpan.org>
license = Perl_5
copyright_holder = Adam Hopkins
copyright_year   = 2017

version = 0.006

[PkgVersion]
[NextRelease]
[@Git]

dist.ini  view on Meta::CPAN

[MetaJSON]
[MinimumPerlFast]

[TestRelease]
[ConfirmRelease]
[UploadToCPAN]

[AutoPrereqs]

[Bugtracker]
web = https://github.com/srchulo/Crypt-Mode-CBC-Easy/issues

lib/Crypt/Mode/CBC/Easy.pm  view on Meta::CPAN

use strict;
package Crypt::Mode::CBC::Easy;
#ABSTRACT: Encrypts/decrypts text and verifies decrypted text with a checksum and a random initialization vector.
$Crypt::Mode::CBC::Easy::VERSION = '0.006';
use Mouse;
use Crypt::CBC;
use Digest::SHA;
use MIME::Base64;
use Bytes::Random::Secure qw//;
use Crypt::Mode::CBC;
use Carp;




has key => (
    isa => 'Str',
    is => 'ro',
    required => 1,
);


has crypt_mode_cbc => (
    isa => 'Crypt::Mode::CBC',
    is => 'ro',
    required => 1,
    default => sub { Crypt::Mode::CBC->new('Twofish') },
);


has block_size => (
    isa => 'Int',
    is => 'ro',
    required => 1,
    default => 16,
);

lib/Crypt/Mode/CBC/Easy.pm  view on Meta::CPAN

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Crypt::Mode::CBC::Easy - Encrypts/decrypts text and verifies decrypted text with a checksum and a random initialization vector.

=head1 VERSION

version 0.006

=head1 SYNOPSIS

    my $crypt = Crypt::Mode::CBC::Easy->new(key => $bytes);
    my $cipher_text = $crypt->encrypt("hello");

    print "Cipher text: $cipher_text\n";

    my $plain_text = $crypt->decrypt($cipher_text);

    print "Plain text: $plain_text\n";

    # encrypt and decrypt an array of values
    my $cipher_text = $crypt->encrypt(@texts);

lib/Crypt/Mode/CBC/Easy.pm  view on Meta::CPAN

        print "plain text: $plain_text\n";
    }

    # or get plain texts as one string separated by separator
    my $plain_text = $crypt->decrypt($cipher_text);

    print "Plain text: $plain_text\n";

=head1 DESCRIPTION

A convenience class that wraps L<Crypt::Mode::CBC> and adds random initialization vector support along with
a checksum to make sure that all decrypted text has not been tampered with. 

=head1 METHODS

=head2 key

The key that will be used for encrypting and decrypting. The key should be the appropriate length for the L<Crypt::Cipher> used with
L</crypt_mode_cbc>. For the default L<Crypt::Cipher> used, Twofish, the key should be 128/192/256 bits.

=head2 crypt_mode_cbc

Sets the L<Crypt::Mode::CBC> that will be used for encryption. Make sure if you change this that you set L</block_size> to the
correct value for the L<Crypt::Cipher> you have chosen. The default value uses L<Crypt::Cipher::Twofish>.

=head2 block_size

Sets the block size for the L<Crypt::Cipher> that is used. Default is 16, because this is the block size for L<Crypt::Cipher::Twofish>.

=head2 checksum_digest_hex

This is a subroutine reference to the digest hex that will be used for the checksum.

    my $crypt = Crypt::Mode::CBC::Easy->new(key => $bytes, checksum_digest_hex => \&Digest::SHA::sha256_hex);

Default is L<Digest::SHA::sha512_hex|Digest::SHA>.

=head2 bytes_random_secure

A L<Bytes::Random::Secure> instance that is used to generate the initialization vector for each encryption. Default is a L<Bytes::Random::Secure> instance with NonBlocking set to true.

=head2 separator

Sets the separator between the initialization vector, the encrypted text, and the checksum. This should not need to be changed, and is only available for backwards



( run in 0.797 second using v1.01-cache-2.11-cpan-df04353d9ac )