[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.4 and 1.5

version 1.4, 2006/11/10 04:21:17 version 1.5, 2006/11/10 04:52:27
Line 9 
Line 9 
 #   This started as Memo.pm, I just made it work for Keyring.  #   This started as Memo.pm, I just made it work for Keyring.
 #  #
 # $Id$  # $Id$
 # $RedRiver: Keyring.pm,v 1.3 2006/02/02 00:59:08 andrew Exp $  # $RedRiver: Keyring.pm,v 1.4 2006/11/10 04:21:17 andrew Exp $
   
 use strict;  use strict;
 package Palm::Keyring;  package Palm::Keyring;
Line 65 
Line 65 
         my $classname   = shift;          my $classname   = shift;
         my $pass = shift;          my $pass = shift;
   
           # Create a generic PDB. No need to rebless it, though.
         my $self        = $classname->SUPER::new(@_);          my $self        = $classname->SUPER::new(@_);
                         # Create a generic PDB. No need to rebless it,  
                         # though.  
   
         $self->{name} = "Keys-Gtkr";    # Default          $self->{name} = "Keys-Gtkr";    # Default
         $self->{creator} = "Gtkr";          $self->{creator} = "Gtkr";
         $self->{type} = "Gkyr";          $self->{type} = "Gkyr";
           # The PDB is not a resource database by
           # default, but it's worth emphasizing,
           # since MemoDB is explicitly not a PRC.
         $self->{attributes}{resource} = 0;          $self->{attributes}{resource} = 0;
                                 # The PDB is not a resource database by  
                                 # default, but it's worth emphasizing,  
                                 # since MemoDB is explicitly not a PRC.  
   
         # Initialize the AppInfo block          # Initialize the AppInfo block
         $self->{appinfo} = {};          $self->{appinfo} = {};
Line 87 
Line 86 
         $self->{version} = 4;          $self->{version} = 4;
   
         # Give the PDB the first record that will hold the encrypted password          # Give the PDB the first record that will hold the encrypted password
         $self->{records} = [          $self->{records} = [ {
                 {                  'category'   => 0,
                   'category' => 0,                  'attributes' => {
                   'attributes' => {                          'private' => 1,
                                                         'private' => 1,                          'Secret'  => 1,
                                                         'Secret' => 1,                          'Dirty'   => 1,
                                                         'Dirty' => 1,                          'dirty'   => 1
                                                         'dirty' => 1  
                                                   },  
                 },                  },
         ];          }, ];
   
         if ($pass) {          if ($pass) {
                 $self->Encrypt($pass);                  $self->Encrypt($pass);
Line 342 
Line 339 
         # if not, then die          # if not, then die
         die "record not 8 byte padded" if (length($plaintext) % 8) && ! $flag;          die "record not 8 byte padded" if (length($plaintext) % 8) && ! $flag;
   
         my %C;          my @C;
         for ( 0..2 ) {          for ( 0..2 ) {
                 $C{$_} = new Crypt::DES( pack( "H*", substr($passphrase, 16*$_, 16 )));                  $C[$_] = new Crypt::DES( pack( "H*", substr($passphrase, 16*$_, 16 )));
         }          }
   
         for ( 0 .. (($size)/8) - 1) {          for ( 0 .. (($size)/8) - 1) {
Line 358 
Line 355 
                         print "Binary:    '" . unpack("b*", $pt) . "'\n";                          print "Binary:    '" . unpack("b*", $pt) . "'\n";
                         #print "PT: '$pt' - Length: " . length($pt) . "\n";                          #print "PT: '$pt' - Length: " . length($pt) . "\n";
                 }                  }
                 $pt = $C{0}->decrypt( $pt );                  $pt = $C[0]->decrypt( $pt );
                 $pt = $C{1}->encrypt( $pt );                  $pt = $C[1]->encrypt( $pt );
                 $pt = $C{2}->decrypt( $pt );                  $pt = $C[2]->decrypt( $pt );
                 #print "PT: '$pt' - Length: " . length($pt) . "\n";                  #print "PT: '$pt' - Length: " . length($pt) . "\n";
                 $cyphertext .= $pt;                  $cyphertext .= $pt;
         }          }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

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