| version 1.2, 2007/02/22 04:57:37 |
version 1.6, 2007/09/13 16:44:39 |
|
|
| #!/usr/bin/perl |
#!/usr/bin/perl -T |
| # $RedRiver: keyring5-samples.t,v 1.1 2007/02/18 05:50:25 andrew Exp $ |
# $RedRiver: keyring5-samples.t,v 1.5 2007/08/10 04:13:31 andrew Exp $ |
| use strict; |
use strict; |
| use warnings; |
use warnings; |
| |
|
| use Test::More tests => 30; |
use Test::More tests => 30; |
| use Data::Dumper; |
|
| |
|
| BEGIN { use_ok( 'Palm::PDB' ); } |
BEGIN { use_ok( 'Palm::PDB' ); } |
| BEGIN { use_ok( 'Palm::Keyring' ); } |
BEGIN { use_ok( 'Palm::Keyring' ); } |
| |
|
| my $password = 'abc'; |
my $password = 'abc'; |
| my $orig_recs = [ |
my $orig_recs = [ |
| [ |
{ |
| { |
0 => { |
| |
'label_id' => 0, |
| |
'data' => '', |
| |
'label' => 'name', |
| |
'font' => 0, |
| |
}, |
| |
2 => { |
| 'label_id' => 2, |
'label_id' => 2, |
| 'data' => 'only password is set', |
'data' => 'only password is set', |
| 'label' => 'password', |
'label' => 'password', |
| 'font' => 0 |
'font' => 0 |
| }, |
}, |
| { |
3 => { |
| 'label_id' => 3, |
'label_id' => 3, |
| 'data' => { |
'data' => { |
| 'month' => 1, |
'month' => 1, |
|
|
| 'label' => 'lastchange', |
'label' => 'lastchange', |
| 'font' => 0 |
'font' => 0 |
| } |
} |
| ], |
}, |
| [ |
{ |
| { |
0 => { |
| |
'label_id' => 0, |
| |
'data' => 'hoenicke', |
| |
'label' => 'name', |
| |
'font' => 0, |
| |
}, |
| |
1 => { |
| 'label_id' => 1, |
'label_id' => 1, |
| 'data' => 'test', |
'data' => 'test', |
| 'label' => 'account', |
'label' => 'account', |
| 'font' => 0 |
'font' => 0 |
| }, |
}, |
| { |
2 => { |
| 'label_id' => 2, |
'label_id' => 2, |
| 'data' => 'abcd1234', |
'data' => 'abcd1234', |
| 'label' => 'password', |
'label' => 'password', |
| 'font' => 0 |
'font' => 0 |
| }, |
}, |
| { |
3 => { |
| 'label_id' => 3, |
'label_id' => 3, |
| 'data' => { |
'data' => { |
| 'month' => 1, |
'month' => 1, |
|
|
| 'label' => 'lastchange', |
'label' => 'lastchange', |
| 'font' => 0 |
'font' => 0 |
| }, |
}, |
| { |
255 => { |
| 'label_id' => 255, |
'label_id' => 255, |
| 'data' => 'This is a short note.', |
'data' => 'This is a short note.', |
| 'label' => 'notes', |
'label' => 'notes', |
| 'font' => 0 |
'font' => 0 |
| } |
} |
| ], |
}, |
| [ |
{ |
| { |
0 => { |
| |
'label_id' => 0, |
| |
'data' => 'name', |
| |
'label' => 'name', |
| |
'font' => 0, |
| |
}, |
| |
2 => { |
| 'label_id' => 2, |
'label_id' => 2, |
| 'data' => 'password (date is 2/2/07)', |
'data' => 'password (date is 2/2/07)', |
| 'label' => 'password', |
'label' => 'password', |
| 'font' => 0 |
'font' => 0 |
| }, |
}, |
| { |
3 => { |
| 'label_id' => 3, |
'label_id' => 3, |
| 'data' => { |
'data' => { |
| 'month' => 1, |
'month' => 1, |
|
|
| 'label' => 'lastchange', |
'label' => 'lastchange', |
| 'font' => 0 |
'font' => 0 |
| } |
} |
| ] |
} |
| ]; |
]; |
| |
|
| foreach my $file ('Keys-None.pdb', 'Keys-3DES.pdb', 'Keys-AES.pdb', 'Keys-AES256.pdb') { |
foreach my $file ('Keys-None.pdb', 'Keys-3DES.pdb', 'Keys-AES.pdb', 'Keys-AES256.pdb') { |
| my $pdb; |
my $pdb; |
| ok( $pdb = new Palm::PDB, 'new Palm::PDB' ); |
ok( $pdb = new Palm::PDB, 'new Palm::PDB' ); |
| ok( $pdb->Load('t/' . $file), "Loading '$file'" ); |
ok( $pdb->Load('t/' . $file), "Loading '$file'" ); |
| |
my $Num_Tests_Left = 5; |
| SKIP: { |
SKIP: { |
| skip 'Digest::HMAC_SHA1 not installed', 5 unless |
skip 'Digest::HMAC_SHA1 not installed', $Num_Tests_Left |
| eval " require Digest::HMAC_SHA1 "; |
unless eval "require Digest::HMAC_SHA1"; |
| |
|
| if ($pdb->{appinfo}->{cipher} > 0) { |
if ($pdb->{appinfo}->{cipher} > 0) { |
| my $crypt = Palm::Keyring::crypts($pdb->{appinfo}->{cipher}); |
my $crypt = Palm::Keyring::crypts($pdb->{appinfo}->{cipher}); |
| skip 'Crypt::CBC not installed', 5 unless |
skip 'Crypt::CBC not installed', $Num_Tests_Left |
| eval "require Crypt::CBC"; |
unless eval "require Crypt::CBC"; |
| skip 'Crypt::' . $crypt->{name} . ' not installed', 5 unless |
skip 'Crypt::' . $crypt->{name} . ' not installed', $Num_Tests_Left |
| eval "require Crypt::$crypt->{name}"; |
unless eval "require Crypt::$crypt->{name}"; |
| } |
} |
| |
|
| $password = 'abc'; |
$password = 'abc'; |