Re: [gentoo-user] zip file encrypt from file manager context menu

2020-07-16 Thread Ashley Dixon
On Thu, Jul 16, 2020 at 02:32:49PM -0600, the...@sys-concept.com wrote:
> zip - has a switch "-e" encrypt
> 
> It works from command line but I'm not sure how to enter it in XFCE in
> in custom action that will appear in file manager context menu.
> 
> I have 7za that works:
> 7za a file.zip %N -tzip -mem=AES256 -mx9 -pxx
> 
> but zip:
> zip file %N -ex

7za accepts the password as part of the command-line invocation,  and  zip  does
not.  It's actually quite appalling,  from  a  security  perspective,  that  7za
allowing the echoing and saving (in the history)  of  the  password.   From  the
manual page of zip(1):

-e
--encrypt
Encrypt the contents of the zip archive using a password which
is entered on the terminal in response to a prompt (this will
not be echoed; if standard error is not a tty, zip will exit
with an error). The password prompt is repeated to save the user
from typing errors.

Since it requires stderr (although I  think  this  should  be  "stdin")  on  the
terminal, you probably won't be able to set this up to use  be  a  context  menu
option, unless you want to make  the  context  menu  button  invoke  a  terminal
window; that's probably the only plausible solution.

> And I have no clue where did I get in 7za parameter: -mem=AES256 -mx9

Again, this can be explained by reading the manual page of 7za(1),  although  it
does require a bit of extra digging, and probably requires p7zip to  be  emerged
with the `doc` USE-flag.  The "-mx[=]9" option is explained in the  "EXAMPLE  1"
section of the man page:

-mx=9  level of compression = 9 (Ultra)

I also think you made a slight error  when  typing  "-mem=AES256".   The  "-mem"
option does exist, but it is used to specify the amount of memory used by  PPMd,
not any sort of encryption algorithm:

mem={Size}[b|k|m|g]
Sets the size of memory used for PPMd. You must specify the size
in bytes, kilobytes, or megabytes.  The maximum value is  2GB  =
2^31 bytes.  The default value is 24  (16MB).   If  you  do  not
specify any symbol from the set [b|k|m|g], the memory size  will
be calculated as (2^Size) bytes.  PPMd uses the same  amount  of
memory for compression and decompression.

"-em", however, makes a lot more sense, and is used to set the encryption method
on the "zip" module:

em={EncryptionMethodID} [default: ZipCrypto]
Sets a encryption method: ZipCrypto, AES128, AES192, AES256

To find the full documentation of the various switches on  your  system,  emerge
p7zip with `doc` and execute `qfile  method.htm`  and  find  the  relevant  file
belonging to p7zip. The docs are really impressive and comprehensive, should you
want to learn more about becoming a power-user of p7zip (I am not  one;  I  just
installed it now to investigate your issue).

Hope this helps,
Ashley.

-- 

Ashley Dixon
suugaku.co.uk

2A9A 4117
DA96 D18A
8A7B B0D2
A30E BF25
F290 A8AA



signature.asc
Description: PGP signature


[gentoo-user] zip file encrypt from file manager context menu

2020-07-16 Thread thelma
zip - has a switch "-e" encrypt

It works from command line but I'm not sure how to enter it in XFCE in
in custom action that will appear in file manager context menu.

I have 7za that works:
7za a file.zip %N -tzip -mem=AES256 -mx9 -pxx

but zip:
zip file %N -ex

doesn't work.  I am missing something.
And I have no clue where did I get in 7za parameter: -mem=AES256 -mx9

-- 
Thelma