Skip Menu |

This queue is for tickets about the Palm-KeyRing CPAN distribution.

Report information
The Basics
Id: 30549
Status: resolved
Worked: 3.5 hours (210 min)
Priority: 0/
Queue: Palm-KeyRing

People
Owner: andrew [...] cpan.org
Requestors: ajw [...] uiuc.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: v5 record underflow
Date: Wed, 7 Nov 2007 09:02:31 -0600
To: bug-palm-keyring [...] rt.cpan.org
From: Andy Wettstein <ajw [...] uiuc.edu>
Hi, I have a problem making a v5 database. Using the example1.pl as a base ( i also needed explicit label_id's): use Palm::Keyring; my $pdb = new Palm::Keyring(-password => '12345', -version => 5, -cipher => 1 ); my $rec = $pdb->append_Record(); $rec->{plaintext} = { 0 => { label => 'name', label_id => 0, font => 0, data => 'Test3' }, 1 => { label => 'account', label_id => 1, font => 0, data => 'anothertestaccount' }, 2 => { label => 'password', label_id => 2, font => 0, data => 'adifferentmypass' }, 255 => { label => 'notes', label_id => 255, font => 0, data => 'now that really roxorZ!' }, }; $pdb->Encrypt($rec); $pdb->Write("Keys-Gtkr-example.PDB"); Opening this PDB on the palm I get Error accessing key database: record underflow (Record_Unpack) Everything actually displays fine, though. Software versions: Palm::Keyring 0.96_05 Gnu Keyring 2.0 Pre 6 -- andy wettstein unix administrator department of physics university of illinois at urbana-champaign
From: ANDREW [...] cpan.org
Now that I know how to log into the RT for CPAN, I will have to look at this. I found my other Palm and got it plugged in. I just have to make it go so I can do tests.
From: ANDREW [...] cpan.org
Here is a copy of a keyring file generated by the script. I do have the issue as well. Not sure why yet. I may have to ask about the definition of a "field" in the HACKING document for Keyring. Show quoted text
> where Field is: > UInt16 len /* length of field excluding header and padding, 0
for last */ Show quoted text
> LabelID label /*
0:name,1:account,2:password,3:last-changed,255:notes */ Show quoted text
> UInt8 font /* Only stdfont(0) allowed */ > data > 0/1 byte padding for next even address.
Download Keys-Gtkr-example.PDB
application/octet-stream 490b

Message body not shown because it is not plain text.

It appears that I can't even read the proper databases that I get from my Palm. So, there is defiantly something that I have screwed up. I am not sure what yet. If I make the change in the diff, and use only the None encryption, then when I generate a PDB from Perl, I can open it on my Palm without errors. I am not really sure why yet though.
Download Keys-Gtkr-Good-from-Keyring-v5.pdb
application/octet-stream 440b

Message body not shown because it is not plain text.

? Diff_that_fixes_None_encryption.diff ? underflow_test.pl ? lib/Palm/.Keyring.pm.swp Index: lib/Palm/Keyring.pm =================================================================== RCS file: /cvs/scripts/misc/Palm/lib/Palm/Keyring.pm,v retrieving revision 1.51 diff -u -r1.51 Keyring.pm --- lib/Palm/Keyring.pm 13 Sep 2007 15:46:09 -0000 1.51 +++ lib/Palm/Keyring.pm 2 Dec 2007 03:05:54 -0000 @@ -306,7 +306,8 @@ } my $packed = _pack_field($field); - $rec->{data} = join $EMPTY, $packed, $rec->{ivec}, $rec->{encrypted}; + $rec->{data} = join $EMPTY, + $packed, $rec->{ivec}, $rec->{encrypted}, chr(0xff) x 2; } else { croak "Unsupported Version $self->{version}";
Download Keys-Gtkr-Bad-from-Palm-Keyring.pdb
application/octet-stream 440b

Message body not shown because it is not plain text.

This patch seems to fix it. I am not sure why though. I found it by comparing a None encrypted file that I generated on the palm vs one I generated with perl. This was the difference. It puts FF FF between the records.
Index: lib/Palm/Keyring.pm =================================================================== RCS file: /cvs/scripts/misc/Palm/lib/Palm/Keyring.pm,v retrieving revision 1.51 diff -u -r1.51 Keyring.pm --- lib/Palm/Keyring.pm 13 Sep 2007 15:46:09 -0000 1.51 +++ lib/Palm/Keyring.pm 4 Dec 2007 03:20:23 -0000 @@ -633,6 +633,7 @@ foreach my $k (keys %{ $new }) { $plaintext .= _pack_field($new->{$k}); } + $plaintext .= chr(0xff) x 2; my $encrypted; if ($c->{name} eq 'None') {
There should be a new dist (0.96_06) available on the CPAN soon enough. If you can't wait, you can get it here: http://perl.somedomain.net/Palm-Keyring/Palm-Keyring-0.96_06.tar.gz Please test and see if it fixes that problem and if you have any more. As an aside. I can't figure out how to write a test for this. Perl seems to make the extra bytes disappear. I am sure that isn't actually the case, but it is more likely the decryption module. I just want to be less generous in what I accept. At least for testing purposes.
Subject: Re: [rt.cpan.org #30549] v5 record underflow
Date: Tue, 4 Dec 2007 11:01:37 -0600
To: ANDREW via RT <bug-Palm-KeyRing [...] rt.cpan.org>
From: Andy Wettstein <ajw [...] uiuc.edu>
Seems to be working fine, now. I'll actually finish writing my password exporter and let you know if I find any more problems. On Tue, Dec 04, 2007 at 12:04:04AM -0500, ANDREW via RT wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=30549 > > > There should be a new dist (0.96_06) available on the CPAN soon enough. > If you can't wait, you can get it here: > > http://perl.somedomain.net/Palm-Keyring/Palm-Keyring-0.96_06.tar.gz > > Please test and see if it fixes that problem and if you have any more. > > > As an aside. I can't figure out how to write a test for this. Perl > seems to make the extra bytes disappear. I am sure that isn't actually > the case, but it is more likely the decryption module. I just want to > be less generous in what I accept. At least for testing purposes.
-- andy wettstein unix administrator department of physics university of illinois at urbana-champaign
Subject: v5 record underflow - resolved
I've been using it for a long time now, I expect I would have gotten errors if it wasn't right.