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

Diff for /palm/Palm-Keyring/lib/Palm/Keyring.pm between version 1.29 and 1.30

version 1.29, 2007/02/19 00:22:42 version 1.30, 2007/02/19 01:37:10
Line 1 
Line 1 
 package Palm::Keyring;  package Palm::Keyring;
 # $RedRiver: Keyring.pm,v 1.28 2007/02/18 05:50:25 andrew Exp $  # $RedRiver: Keyring.pm,v 1.29 2007/02/19 00:22:42 andrew Exp $
 ########################################################################  ########################################################################
 # Keyring.pm *** Perl class for Keyring for Palm OS databases.  # Keyring.pm *** Perl class for Keyring for Palm OS databases.
 #  #
Line 154 
Line 154 
     } elsif ($self->{version} == 5) {      } elsif ($self->{version} == 5) {
         my $blocksize = $CRYPTS[ $self->{appinfo}->{cipher} ]{blocksize};          my $blocksize = $CRYPTS[ $self->{appinfo}->{cipher} ]{blocksize};
         my ($field, $extra) = _parse_field($rec->{data});          my ($field, $extra) = _parse_field($rec->{data});
         my ($ivec, $encrypted) = unpack "A$blocksize A*", $extra;          my $ivec      = substr $extra, 0, $blocksize;
           my $encrypted = substr $extra, $blocksize;
   
         if ($self->{options}->{v4compatible}) {          if ($self->{options}->{v4compatible}) {
             $rec->{name} = $field->{data};              $rec->{name} = $field->{data};
Line 209 
Line 210 
         my $len = length $packed;          my $len = length $packed;
         my $blocksize = $CRYPTS[ $self->{appinfo}->{cipher} ]{blocksize};          my $blocksize = $CRYPTS[ $self->{appinfo}->{cipher} ]{blocksize};
   
         $rec->{data} = pack "A$len A$blocksize A*",          $rec->{data} = join '', $packed, $rec->{ivec}, $rec->{encrypted};
             $packed, $rec->{ivec}, $rec->{encrypted};  
   
     } else {      } else {
         die 'Unsupported Version';          die 'Unsupported Version';
Line 481 
Line 481 
     my $old    = shift;      my $old    = shift;
     my $key    = shift;      my $key    = shift;
     my $cipher = shift;      my $cipher = shift;
     my $ivec   = shift || pack("C*",map {rand(256)} 1..8);      my $length = $CRYPTS[ $cipher ]{blocksize};
       my $ivec   = shift || pack("C*",map {rand(256)} 1..$length);
   
     my $keylen      = $CRYPTS[ $cipher ]{keylen};      my $keylen      = $CRYPTS[ $cipher ]{keylen};
     my $cipher_name = $CRYPTS[ $cipher ]{name};      my $cipher_name = $CRYPTS[ $cipher ]{name};
Line 594 
Line 595 
         croak("Needed parameter 'record' not passed!\n");          croak("Needed parameter 'record' not passed!\n");
     }      }
   
     if ( ! $self->Password($pass)) {      if ( $pass && ! $self->Password($pass)) {
         croak("Invalid Password!\n");          croak("Invalid Password!\n");
     }      }
   
Line 713 
Line 714 
   
     if (! $pass) {      if (! $pass) {
         delete $self->{password};          delete $self->{password};
         delete $self->{key};          delete $self->{appinfo}->{key};
         return 1;          return 1;
     }      }
   
Line 1041 
Line 1042 
         return undef, $field;          return undef, $field;
     }      }
     my $unpackstr = "S1 C1 C1 A$len";      my $unpackstr = "S1 C1 C1 A$len";
     if ($len % 2) {      if ($len % 2 && $len + 4 < length $field) {
         # trim the 0/1 byte padding for next even address.          # trim the 0/1 byte padding for next even address.
         $unpackstr .= ' x'          $unpackstr .= ' x'
     }      }

Legend:
Removed from v.1.29  
changed lines
  Added in v.1.30

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>