in reply to Re: Re: Encrypting a Filename
in thread Encrypting a Filename

So take note of the timestamp on secretfile.dat, tar it up, and then set the timestampe on the tar to that timestamp.

If your entire tree is done with this tar mechanism, then the backup process should work fine.

xoxo,
Andy

%_=split/;/,".;;n;u;e;ot;t;her;c; ".   #   Andy Lester
'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
"hack";print map delete$_{$_},split//,q<   andy@petdance.com   >

Replies are listed 'Best First'.
Re: Re: Re: Re: Encrypting a Filename
by John M. Dlugosz (Monsignor) on Jun 15, 2001 at 22:55 UTC
    The timestamp is not the problem. The timestamp on the tar will naturally work just as well, anyway, without having to reset it. The problem is with the filename. If it is not 1-to-1, then it will have to open the file to check the original file name, to be sure it has the right one.

    —John

      So give the tar the one-way crypted version of the real filename. As in, roughly:
      my $timestamp = timestamp_of( $innerfile ); my $tarname = crypt( $innerfile, $innerfile ) . ".tar"; $tarname = substr( $tarname, 2 ); system( 'tar $tarname cvf $innerfile' ); touch( $tar, $timestamp );
      The crypted filename will always be the same thing. So foo.txt will always create the same .tar file.

      Also, you'll want to drop the first 2 chars of the crypted filename, because they are the salt, which in this case is the first two letters of the inner filename.

      xoxo,
      Andy

      %_=split/;/,".;;n;u;e;ot;t;her;c; ".   #   Andy Lester
      'Perl ;@; a;a;j;m;er;y;t;p;n;d;s;o;'.  #   http://petdance.com
      "hack";print map delete$_{$_},split//,q<   andy@petdance.com   >
      
        If the real original filename is inside the file, then I agree a one-way mapping is OK, since the feature of "restore this directory" can be implemented by opening each backup file and checking the original name

        Is crypt going to generate a unique one-way mapping? If so, I don't see why that's any better than just using a 2-way function. If not, then it still has the problem of needing to open the file before overcopying to make sure it's the right one, giving disambiguating suffixes to the name, and searching for a base name with the right suffix.

        —John