# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1312145910 -7200 # Node ID b5db10953648017623b9176c50233e2afc98d5ab # Parent 6bf98af421f32e533310f60d0a3c8399e5d6d5de now decryption in fuse module works diff -r 6bf98af421f3 -r b5db10953648 bin/imager.fuse --- a/bin/imager.fuse Sun Jul 31 16:23:14 2011 +0200 +++ b/bin/imager.fuse Sun Jul 31 22:58:30 2011 +0200 @@ -18,11 +18,13 @@ debug => undef, detach => 1, tmp => undef, + pass => undef, ); lock_keys %o; use constant ME => basename $0; use constant BS => 4 * 1024; +use constant CIPHER => "aes-128-cbc"; my ($DATA, $IDX); @@ -47,6 +49,7 @@ "detach!" => \$o{detach}, "tmp:s" => sub { $o{tmp} = length $_[1] ? $_[1] : $ENV{TMP} // "/tmp" }, "h|help" => sub { pod2usage(-verbose => 1, -exit => 0) }, + "p|pass=s" => \$o{pass}, "m|man" => sub { pod2usage( -verbose => 2, @@ -227,6 +230,28 @@ gunzip($fh => \$cache{data}) or die $GunzipError; } + elsif (-e "$fn.x") { + open(my $fh => "openssl @{[CIPHER]} -d -pass '$o{pass}' -in '$fn.x'|"); + binmode($fh); + local $/ = undef; + $cache{data} = <$fh>; + close($fh); + } + elsif (-e "$fn.gz.x") { + open(my $fh => "openssl @{[CIPHER]} -d -pass '$o{pass}' -in '$fn.gz.x'|"); + binmode($fh); + gunzip($fh => \$cache{data}) + or die $GunzipError; + close($fh); + } + elsif (-e "$fn.x.gz") { + warn "$fn.x.gz is depreciated!\n"; + open(my $fh => "zcat $fn.x.gz | openssl @{[CIPHER]} -d -pass '$o{pass}'|"); + binmode($fh); + local $/ = undef; + $cache{data} = <$fh>; + close($fh); + } $cache{fn} = $fn; } @@ -309,6 +334,20 @@ =over 4 +=item B<-d> | B<--debug> + +Enables debugging output from B. When using this option, +B does not detach from the terminal. (default: off) + +=item B<-->I<[no]>B + +Detach or don't detach from the terminal. (default: detach) + +=item B<-p> I | B<--pass>=I + +Password to be used for decryption. For the format please refer +L. (default: not set) + =item B<--tmp> [I] Write dirty blocks into a buffer file in the specified tmp directory. @@ -317,15 +356,6 @@ B: The temporary file may get B. -=item B<-d>|B<--debug> - -Enables debugging output from B. When using this option, -B does not detach from the terminal. (default: off) - -=item B<-->I<[no]>B - -Detach or don't detach from the terminal. (default: detach) - =item B<-h>|B<--help> =item B<-m>|B<--man> diff -r 6bf98af421f3 -r b5db10953648 bin/imager.restore --- a/bin/imager.restore Sun Jul 31 16:23:14 2011 +0200 +++ b/bin/imager.restore Sun Jul 31 22:58:30 2011 +0200 @@ -142,7 +142,7 @@ =item B<-p> I | B<--pass=>I In case you expect encrypted data, this option takes the argument for -B's C<-pass> option. See L for mor information. +B's C<-pass> option. See L for mor information. (default: stdin) =item B<-h>|B<--help> diff -r 6bf98af421f3 -r b5db10953648 bin/imager.save --- a/bin/imager.save Sun Jul 31 16:23:14 2011 +0200 +++ b/bin/imager.save Sun Jul 31 22:58:30 2011 +0200 @@ -255,7 +255,7 @@ =item B<-p> I | B<--pass>=I Use symmetric encryption for writing the data blocks. This option -is passed to L. +is passed to L. =item B<-z> [I]|B<--compress>[=I]