[BACK]Return to test1.pl CVS log [TXT][DIR] Up to [local] / palm / Palm-Keyring

File: [local] / palm / Palm-Keyring / test1.pl (download)

Revision 1.3, Wed Dec 6 18:45:42 2006 UTC (17 years, 5 months ago) by andrew
Branch: MAIN
CVS Tags: PALM_KEYRING_0_96_06, HEAD
Changes since 1.2: +25 -22 lines

I don't know why I thought it worked before.  It seems to work now though, at least I can create and decrypt my own pdbs.  I don't know if I am outside compatible though.

#!/usr/bin/perl
use strict;
use warnings;

use lib 'lib';
use Palm::Keyring;

use constant ENCRYPT    =>  1;
use constant DECRYPT    =>  0;

my $plaintext = "Hello World";
my $password  = "12345";

print "Plaintext: '$plaintext'\n";
print "Password:  '$password'\n";

my $digest    = Palm::Keyring::_calc_keys($password);
print "Digest:    '$digest'\n";

my $encrypted = Palm::Keyring::_crypt3des($plaintext, $digest, ENCRYPT);
print "Encrypted: '" . unpack("H*", $encrypted) . "'\n";

my $decrypted = Palm::Keyring::_crypt3des($encrypted, $digest, DECRYPT);
print "Decrypted: '$decrypted'\n";