Alt-Crypt-RSA-BigInt

 view release on metacpan or  search on metacpan

.travis.yml  view on Meta::CPAN

    #- cpanm Data::Buffer
    #- cpanm Class::Loader
    #- cpanm Sort::Versions
    #- cpanm Convert::ASCII::Armour
    #- cpanm Tie::EncryptedHash
    #- cpanm Data::Dumper
    #- cpanm Digest::MD2
    #- cpanm Digest::MD5
    #- cpanm Digest::SHA
    #- cpanm Crypt::Blowfish
    #- cpanm Crypt::CBC
    #- cpanm Math::BigInt::GMP
    #- cpanm Math::Prime::Util::GMP
    #- cpanm Math::Prime::Util

install:
    #- cpanm -v --installdeps --notest --mirror http://cpan.mirrors.travis-ci.org --mirror http://dl.ambiweb.de/mirrors/ftp.cpan.org --mirror http://cpan.cse.msu.edu .
    - cpanm -v --installdeps --notest .

script: "perl Makefile.PL; make test"
# branches:

Changes.old  view on Meta::CPAN


  * ::Key::Private::read() will call reveal() if the password is provided
    at construction. 

  * Added support for unencrypted keys to ::Key::Private.

  * ::Key::Private does not convert pari2pv at every STORE().
    Tie::EncryptedHash is created explicitely at hide().
    
  * Put together ::Key::Private::SSH from Benjamin Trott's patches and
    wrote ::Key::Public::SSH. ::Key::Private::SSH's CBC encryption is 
    not compatible with SSH yet.

  * Documented the Crypt::RSA error handling mechanism in
    Crypt::RSA::Errorhandler.

  * Encryption schemes, signature schemes and post processors are now
    loaded at runtime in Crypt::RSA. Suitable values for these can be
    specified at object construction. Primary reason for this is to
    interface with modules not included in the Crypt::RSA bundle.

META.json  view on Meta::CPAN

         "requires" : {
            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Carp" : "0",
            "Class::Loader" : "0",
            "Convert::ASCII::Armour" : "0",
            "Crypt::Blowfish" : "0",
            "Crypt::CBC" : "2.17",
            "Data::Buffer" : "0",
            "Data::Dumper" : "0",
            "Digest::MD2" : "0",
            "Digest::MD5" : "0",
            "Digest::SHA" : "0",
            "Exporter" : "0",
            "Math::BigInt" : "1.78",
            "Math::BigInt::GMP" : "0",
            "Math::Prime::Util" : "0.64",
            "Math::Prime::Util::GMP" : "0",

META.yml  view on Meta::CPAN

no_index:
  directory:
    - t
    - inc
    - lib/Crypt
requires:
  Carp: '0'
  Class::Loader: '0'
  Convert::ASCII::Armour: '0'
  Crypt::Blowfish: '0'
  Crypt::CBC: '2.17'
  Data::Buffer: '0'
  Data::Dumper: '0'
  Digest::MD2: '0'
  Digest::MD5: '0'
  Digest::SHA: '0'
  Exporter: '0'
  Math::BigInt: '1.78'
  Math::BigInt::GMP: '0'
  Math::Prime::Util: '0.64'
  Math::Prime::Util::GMP: '0'

Makefile.PL  view on Meta::CPAN

    BUILD_REQUIRES=>{
                      'Test::More'       => '0.45',
                      'Benchmark'        => 0,
                      'MIME::Base64'     => 0,
                    },
    PREREQ_PM    => {
                      'Math::BigInt'           => '1.78', # try => backend
                      'Math::Prime::Util'      => '0.64', # built in csprng
                      'Carp'                   => 0,
                      'Exporter'               => 0,
                      'Crypt::CBC'             => '2.17',
                      'Crypt::Blowfish'        => 0,
                      'Data::Dumper'           => 0,
                      'Tie::EncryptedHash'     => 0,
                      'Convert::ASCII::Armour' => 0,
                      'Sort::Versions'         => 0,
                      'Digest::SHA'            => 0,
                      'Digest::MD5'            => 0,
                      'Digest::MD2'            => 0,
                      'Class::Loader'          => 0,
                      'Data::Buffer'           => 0,

lib/Crypt/RSA.pm  view on Meta::CPAN

the subject "Crypt::RSA license". Please don't send me mail
asking if you need a commercial license. You don't, if
Artistic of GPL suit you fine.

=head1 SEE ALSO

L<Crypt::RSA::Primitives>,
L<Crypt::RSA::DataFormat>,
L<Crypt::RSA::Errorhandler>,
L<Crypt::RSA::Debug>,
L<Crypt::CBC>,
L<Crypt::Blowfish>,
L<Tie::EncryptedHash>,
L<Convert::ASCII::Armour>,
L<Class::Loader>,
L<Math::Prime::Util>.

=head1 REPORTING BUGS

All bug reports related to Crypt::RSA should go to rt.cpan.org 
at C<http://rt.cpan.org/Dist/Display.html?Queue=Crypt-RSA>

lib/Crypt/RSA/Key.pm  view on Meta::CPAN

=item B<Identity>

A string that identifies the owner of the key. This string usually takes
the form of a name and an email address. The identity is not bound to the
key with a signature. However, a future release or another module will
provide this facility. 

=item B<Cipher>

The block cipher which is used for encrypting the private key. Defaults to
`Blowfish'. Cipher could be set to any value that works with Crypt::CBC(3)
and Tie::EncryptedHash(3).

=item B<Verbosity> 

When set to 1, generate() will draw a progress display on STDOUT.

=item B<Filename>

The generated key pair will be written to disk, in $Filename.public and
$Filename.private files, if this argument is provided. Disk writes can be

lib/Crypt/RSA/Key/Private.pm  view on Meta::CPAN


=item Password

Password with which the private key is encrypted, or should be encrypted
(in case of a new key).

=item Cipher

Name of the symmetric cipher in which the private key is encrypted (or
should be encrypted). The default is "Blowfish" and possible values
include DES, IDEA, Twofish and other ciphers supported by Crypt::CBC.

=back

=item B<reveal()>

If the key is not decrypted at C<new()>, it can be decrypted by
calling C<reveal()> with a C<Password> argument.

=item B<hide()>

lib/Crypt/RSA/Key/Private/SSH.pm  view on Meta::CPAN

# with it given the RSA1 format.  I don't think any of this is standardized.
# OpenSSH supports only: none, des, 3des, and blowfish here.  This set of
# numbers below 10 match.  Values above 10 are well supported by Perl modules.
BEGIN {
    # CIPHERS : Used by deserialize to map numbers to modules.
    %CIPHERS = (
       # 0 = none
        1 => [ 'IDEA' ],
        2 => [ 'DES', 'DES_PP' ],
        3 => [ 'DES_EDE3' ],
# From what I can see, none of the 3+ RC4 modules are CBC compatible
#        5 => [ 'RC4' ],
        6 => [ 'Blowfish', 'Blowfish_PP' ],
       10 => [ 'Twofish2' ],
       11 => [ 'CAST5', 'CAST5_PP' ],
       12 => [ 'Rijndael', 'OpenSSL::AES' ],
       13 => [ 'RC6' ],
       14 => [ 'Camellia', 'Camellia_PP' ],
# Crypt::Serpent is broken and abandonded.
    );
    # CIPHERS_TEXT : Used by serialize to map names to modules to numbers

lib/Crypt/RSA/Key/Private/SSH.pm  view on Meta::CPAN

      'RIJNDAEL'   => 12,
      'AES'        => 12,
      'OPENSSL::AES'=>12,
      'RC6'        => 13,
      'CAMELLIA'   => 14,
    );
}

use Carp qw( croak );
use Data::Buffer;
use Crypt::CBC 2.17;   # We want a good version
use Crypt::RSA::Key::Private;
use base qw( Crypt::RSA::Key::Private );

sub deserialize {
    my($key, %params) = @_;
    my $passphrase = defined $params{Password} ? $params{Password}
                   : defined $key->Password    ? $key->Password
                   : '';
    my $string = $params{String};
    croak "Must supply String=>'blob' to deserialize" unless defined $string;

lib/Crypt/RSA/Key/Private/SSH.pm  view on Meta::CPAN

          my $class = "Crypt::$name";
          (my $file = $class) =~ s=::|'=/=g;
          if ( eval { require "$file.pm"; 1 } ) {
            $cipher_name = $name; last;
          }
        }
        if (!defined $cipher_name) {
          croak "Unsupported cipher '$cipher_names->[0]': $@";
        }

        my $cipher = Crypt::CBC->new( -key    => $passphrase,
                                      -cipher => $cipher_name );
        my $decrypted =
            $cipher->decrypt($buffer->bytes($buffer->offset));
        $buffer->empty;
        $buffer->append($decrypted);
    }

    my $check1 = $buffer->get_int8;
    my $check2 = $buffer->get_int8;
    unless ($check1 == $buffer->get_int8 &&

lib/Crypt/RSA/Key/Private/SSH.pm  view on Meta::CPAN

          my $class = "Crypt::$name";
          (my $file = $class) =~ s=::|'=/=g;
          if ( eval { require "$file.pm"; 1 } ) {
            $cipher_name = $name; last;
          }
        }
        if (!defined $cipher_name) {
          croak "Unsupported cipher '$cipher_names->[0]': $@";
        }

        my $cipher = Crypt::CBC->new( -key    => $passphrase,
                                      -cipher => $cipher_name );
        $encrypted->append( $cipher->encrypt($buffer->bytes) );
    }
    else {
        $encrypted->append($buffer->bytes);
    }

    $encrypted->bytes;
}



( run in 0.692 second using v1.01-cache-2.11-cpan-9bca49b1385 )