Palm-Keyring

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

(
	module_name => 'Palm::Keyring',
    dist_abstract => 'Handler for Palm Keyring databases.',
	license  => 'perl',
	requires => {
		'perl'             => '5.6.1',
		'Palm::StdAppInfo' => '0',
    },
    recommends => {
		'Digest::MD5'       => '0',
		'Crypt::DES'        => '0',
        'Crypt::CBC'        => '0',
        'Digest::HMAC_SHA1' => '0',
        'Digest::SHA1'      => '0',
	},
	create_makefile_pl => 'traditional',
	create_readme => 1,
	create_html   => 1,
	auto_features => {
		YAML_support =>
		{

META.yml  view on Meta::CPAN

  - 'Andrew Fresh E<lt>andrew@cpan.orgE<gt>'
abstract: Handler for Palm Keyring databases.
license: perl
resources:
  license: http://dev.perl.org/licenses/
requires:
  Palm::StdAppInfo: 0
  perl: 5.6.1
recommends:
  Crypt::CBC: 0
  Crypt::DES: 0
  Digest::HMAC_SHA1: 0
  Digest::MD5: 0
  Digest::SHA1: 0
provides:
  Palm::Keyring:
    file: lib/Palm/Keyring.pm
    version: 0.95
generated_by: Module::Build version 0.2806
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.2.html

README  view on Meta::CPAN

        Reverses ParseRecord and then sends it through
        Palm::StdAppInfo::PackRecord()

DEPENDENCIES
    Palm::StdAppInfo

    For v4 databases

    Digest::MD5

    Crypt::DES

    For v5 databases

    Digest::HMAC_SHA1

    Digest::SHA1

    Depending on how the database is encrypted

    Crypt::CBC - For any encryption but None

    Crypt::DES_EDE3 - DES_EDE3 encryption

    Crytp::Rijndael - AES encryption schemes

THANKS
    I would like to thank the helpful Perlmonk shigetsu who gave me some
    great advice and helped me get my first module posted.
    <http://perlmonks.org/?node_id=596998>

    I would also like to thank Johan Vromans <jvromans@squirrel.nl> --
    <http://www.squirrel.nl/people/jvromans>. He had his own Palm::KeyRing

lib/Palm/Keyring.pm  view on Meta::CPAN

    my $key = _pbkdf2( $pass, $salt, $iter, $keylen, \&hmac_sha1 );
    if ($dop) { $key = _DES_odd_parity($key); }

    my $hash = unpack("H*", substr(sha1($key.$salt),0, 8));

    return $key, $hash;
}

sub _crypt3des 
{
    require Crypt::DES;

    my ( $plaintext, $passphrase, $flag ) = @_;

    $passphrase   .= $SPACE x ( 16 * 3 );
    my $cyphertext = $EMPTY;

    my $size = length $plaintext;

    #print "STRING: '$plaintext' - Length: " . (length $plaintext) . "\n";

    my @C;
    for ( 0 .. 2 ) {
        $C[$_] =
          new Crypt::DES( pack 'H*', ( substr $passphrase, 16 * $_, 16 ));
    }

    for ( 0 .. ( ($size) / 8 ) ) {
        my $pt = substr $plaintext, $_ * 8, 8;

        #print "PT: '$pt' - Length: " . length($pt) . "\n";
        if (! length $pt) { next; };
        if ( (length $pt) < 8 ) {
            if ($flag == $DECRYPT) { croak('record not 8 byte padded'); };
            my $len = 8 - (length $pt);

lib/Palm/Keyring.pm  view on Meta::CPAN

=back

=head1 DEPENDENCIES

Palm::StdAppInfo

B<For v4 databases>

Digest::MD5

Crypt::DES

B<For v5 databases>

Digest::HMAC_SHA1

Digest::SHA1

Depending on how the database is encrypted

Crypt::CBC - For any encryption but None

Crypt::DES_EDE3 - DES_EDE3 encryption

Crytp::Rijndael - AES encryption schemes

=head1 THANKS

I would like to thank the helpful Perlmonk shigetsu who gave me some great advice
and helped me get my first module posted.  L<http://perlmonks.org/?node_id=596998>

I would also like to thank 
Johan Vromans

t/keyring.t  view on Meta::CPAN

    SKIP: {
        if (defined $options->{cipher} && $options->{cipher} > 0) {
            my $crypt = Palm::Keyring::crypts($options->{cipher});
            skip 'Crypt::CBC not installed', 21 unless 
                eval "require Crypt::CBC";
            skip 'Crypt::' . $crypt->{name} . ' not installed', 21 unless 
                eval "require Crypt::$crypt->{name}";
        }

        if ($options->{version} == 4) {
            skip 'Crypt::DES not installed', 21 unless 
                eval " require Crypt::DES ";
            skip 'Digest::MD5 not installed', 21 unless 
                eval " require Digest::MD5 ";
        } elsif ($options->{version} == 5) {
            skip 'Digest::HMAC_SHA1 not installed', 21 unless 
                eval " require Digest::HMAC_SHA1 ";
        }

        ok( $pdb = new Palm::Keyring($options), 
            'New Palm::Keyring v' . $options->{version} );



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