Convert-PEM

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

      class.
    - Switched to using Module::Install in Makefile.PL.

0.06  2001.09.14
    - Use Convert::PEM::ErrorHandler instead of defining error/errstr
      methods for each class. This also lets us use error/errstr as
      class methods.
    - Added Macro param to constructor; this is useful when dealing
      with an ASN.1 description that defines multiple ASN.1 macros,
      and we want to decode/encode using a specific macro.
    - Removed Crypt::DES_EDE3 from this distribution; it is now
      packaged and distributed separately, and has been added as a
      prereq for Convert::PEM.

0.05  2001.05.11
    - Changed explode/implode so that they return/get list of headers
      in order in which they appear in the file. This fixes the bug
      where openssl-compatible PEM readers (like ssh-keygen in OpenSSH)
      could sometimes not read encrypted files (depending on the order
      given to the headers by the hash).

META.json  view on Meta::CPAN

   "prereqs" : {
      "configure" : {
         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Class::ErrorHandler" : "0",
            "Convert::ASN1" : "0.34",
            "Crypt::DES_EDE3" : "0",
            "Crypt::PRNG" : "0",
            "Digest::MD5" : "0",
            "MIME::Base64" : "0"
         }
      },
      "test" : {
         "requires" : {
            "Test::Exception" : "0",
            "Test::More" : "0"
         }

META.yml  view on Meta::CPAN

dynamic_config: 0
generated_by: 'Dist::Zilla version 6.032, 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: Convert-PEM
requires:
  Class::ErrorHandler: '0'
  Convert::ASN1: '0.34'
  Crypt::DES_EDE3: '0'
  Crypt::PRNG: '0'
  Digest::MD5: '0'
  MIME::Base64: '0'
resources:
  homepage: https://github.com/perl-Crypt-OpenPGP/Convert-PEM
  repository: https://github.com/perl-Crypt-OpenPGP/Convert-PEM.git
version: '0.13'
x_generated_by_perl: v5.38.2
x_maintainers:
  - 'Timothy Legge <timlegge@gmail.com>'

Makefile.PL  view on Meta::CPAN

  "AUTHOR" => "Benjamin Trott <cpan\@stupidfool.org>",
  "CONFIGURE_REQUIRES" => {
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "Convert-PEM",
  "LICENSE" => "perl",
  "NAME" => "Convert::PEM",
  "PREREQ_PM" => {
    "Class::ErrorHandler" => 0,
    "Convert::ASN1" => "0.34",
    "Crypt::DES_EDE3" => 0,
    "Crypt::PRNG" => 0,
    "Digest::MD5" => 0,
    "MIME::Base64" => 0
  },
  "TEST_REQUIRES" => {
    "Test::Exception" => 0,
    "Test::More" => 0
  },
  "VERSION" => "0.13",
  "test" => {
    "TESTS" => "t/*.t"
  }
);


my %FallbackPrereqs = (
  "Class::ErrorHandler" => 0,
  "Convert::ASN1" => "0.34",
  "Crypt::DES_EDE3" => 0,
  "Crypt::PRNG" => 0,
  "Digest::MD5" => 0,
  "MIME::Base64" => 0,
  "Test::Exception" => 0,
  "Test::More" => 0
);


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

README  view on Meta::CPAN


  Convert::PEM->list_cipher_modules([$cipher_name])
    If a *cipher_name* is provided, will return the module configured for
    the matching cipher name or "undef" if cipher is not supported. If
    *cipher_name* is not provided, will return a list of modules names
    configured as an array in array context or as a colon separated list in
    scalar context.

    Here is a list of the cipher modules used by default.

    *   Crypt::DES

    *   Crypt::DES_EDE3

    *   Crypt::Rijndael - "AES-128-CBC, AES-192-CBC and AES-256-CBC"

    *   Crypt::Camellia - "CAMELLIA-128-CBC, CAMELLIA-192-CBC and
        CAMELLIA-256-CBC"

    *   Crypt::IDEA

    *   Crypt::SEED

dist.ini  view on Meta::CPAN


[CopyFilesFromBuild::Filtered]
copy = Makefile.PL

[OurPkgVersion]

[Prereqs]
Class::ErrorHandler = 0
MIME::Base64 = 0
Convert::ASN1 = 0.34
Crypt::DES_EDE3 = 0
Crypt::PRNG = 0
Digest::MD5 = 0

[Prereqs/TestRequires]
Test::More = 0
Test::Exception = 0

[GithubMeta]
remote = upstream

lib/Convert/PEM.pm  view on Meta::CPAN

    $content =~ s!(.{1,64})!$1\n!g;
    my $headers = join '',
                  map { "$_->[0]: $_->[1]\n" }
                  @{ $param{Headers} };
    $headers .= "\n" if $headers;
    "$head\n$headers$content$tail\n";
}

use vars qw( %CTYPES );
%CTYPES = (
    'DES-CBC'           =>    {c => 'Crypt::DES',         ks=>8,  bs=>8,  },
    'DES-EDE3-CBC'      =>    {c => 'Crypt::DES_EDE3',    ks=>24, bs=>8,  },
    'AES-128-CBC'       =>    {c => 'Crypt::Rijndael',    ks=>16, bs=>16, },
    'AES-192-CBC'       =>    {c => 'Crypt::Rijndael',    ks=>24, bs=>16, },
    'AES-256-CBC'       =>    {c => 'Crypt::Rijndael',    ks=>32, bs=>16, },
    'CAMELLIA-128-CBC'  =>    {c => 'Crypt::Camellia',    ks=>16, bs=>16, },
    'CAMELLIA-192-CBC'  =>    {c => 'Crypt::Camellia',    ks=>24, bs=>16, },
    'CAMELLIA-256-CBC'  =>    {c => 'Crypt::Camellia',    ks=>32, bs=>16, },
    'IDEA-CBC'          =>    {c => 'Crypt::IDEA',        ks=>16, bs=>8,  },
    'SEED-CBC'          =>    {c => 'Crypt::SEED',        ks=>16, bs=>16, },
);

lib/Convert/PEM.pm  view on Meta::CPAN

If a I<cipher_name> is provided, will return the module configured for
the matching cipher name or C<undef> if cipher is not supported.
If I<cipher_name> is not provided, will return a list of modules names
configured as an array in array context or as a colon separated list in
scalar context.

Here is a list of the cipher modules used by default.

=over 4

=item * L<Crypt::DES>

=item * L<Crypt::DES_EDE3>

=item * L<Crypt::Rijndael> - C<AES-128-CBC, AES-192-CBC and AES-256-CBC>

=item * L<Crypt::Camellia> - C<CAMELLIA-128-CBC, CAMELLIA-192-CBC and CAMELLIA-256-CBC>

=item * Crypt::L<IDEA>

=item * L<Crypt::SEED>

=back

lib/Convert/PEM/CBC.pm  view on Meta::CPAN

__END__

=head1 NAME

Convert::PEM::CBC - Cipher Block Chaining Mode implementation

=head1 SYNOPSIS

    use Convert::PEM::CBC;
    my $cbc = Convert::PEM::CBC->new(
                         Cipher     => 'Crypt::DES_EDE3',
                         Passphrase => 'foo'
           );

    my $plaintext = 'foo bar baz';
    $cbc->encrypt($plaintext);

=head1 DESCRIPTION

I<Convert::PEM::CBC> implements the CBC (Cipher Block Chaining)
mode for encryption/decryption ciphers; the CBC is designed for

lib/Convert/PEM/CBC.pm  view on Meta::CPAN


Creates a new I<Convert::PEM::CBC> object and initializes it.
Returns the new object.

I<%args> can contain:

=over 4

=item * Cipher

Either the name of an encryption cipher class (eg. I<Crypt::DES>),
or an object already blessed into such a class. The class must
support the I<keysize>, I<blocksize>, I<encrypt>, and I<decrypt>
methods. If the value is a blessed object, it is assumed that the
object has already been initialized with a key.

This argument is mandatory.

=item * Passphrase

A passphrase to encrypt/decrypt the content. This is different in

t/03-ede3.t  view on Meta::CPAN

use Test::More tests => 6;

use Convert::PEM::CBC;

my $KEY = pack "H64", ("0123456789ABCDEF" x 4);
my $IV  = "\0" x 8;

my($cbc1, $cbc2);

$cbc1 = Convert::PEM::CBC->new(
                  Cipher => 'Crypt::DES_EDE3',
                  Key    => $KEY,
                  IV     => $IV,
         );
isa_ok $cbc1, 'Convert::PEM::CBC';

$cbc2 = Convert::PEM::CBC->new(
                  Cipher => 'Crypt::DES_EDE3',
                  Key    => $KEY,
                  IV     => $IV,
         );
isa_ok $cbc2, 'Convert::PEM::CBC';

my($enc, $dec);
$enc = $cbc1->encrypt( _checkbytes() );
ok defined $enc, 'got something from encrypt';
$dec = $cbc2->decrypt($enc);
ok defined $dec, 'got something from decrypt';

t/05-des.t  view on Meta::CPAN

use strict;
use Test::More;
use Test::Exception;
use Convert::PEM;

require "./t/func.pl";

my $pem = get_rsa();

# choose some modules to test
my @modules = ("Crypt::DES");

my @tests = (
	{ name => "DES-CBC", rx => "t/data/rsakey-des.pem",
        tx => "t/data/rsakey-des.wr.pem", hash => "45f605c6186eaea0730958b0e3da52e4", },
	{ name => "DES-CBC", rx => "t/data/rsakey2-des.pem",
        tx => "t/data/rsakey2-des.wr.pem", hash => "9b334c60a2c0c2a543ac742ebf1f8ccd", },
);

run_tests($pem,\@modules,\@tests);

t/07-3des.t  view on Meta::CPAN

use strict;
use Test::More;
use Test::Exception;
use Convert::PEM;

require "./t/func.pl";

my $pem = get_rsa();

# choose some modules to test
my @modules = ("Crypt::DES_EDE3");

my @tests = (
	{ name => "DES-EDE3-CBC", rx => "t/data/rsakey-3des.pem",
        tx => "t/data/rsakey-3des.wr.pem", hash => "45f605c6186eaea0730958b0e3da52e4", },
	{ name => "DES-EDE3-CBC", rx => "t/data/rsakey2-3des.pem",
        tx => "t/data/rsakey2-3des.wr.pem", hash => "9b334c60a2c0c2a543ac742ebf1f8ccd", },
);

run_tests($pem,\@modules,\@tests);



( run in 0.328 second using v1.01-cache-2.11-cpan-9a3d99fc6dc )