Command line parameter questions for encryption 7zip archive?

Help
Thomas
2013-07-28
2013-07-29
  • Thomas
    Thomas
    2013-07-28

    As part of a DOS batch script I want not only compress a whole directory tree but encrypt it afterwards. The only command line flag I found so far is

    -pSECRET

    which means use the password "SECRET" for encryption.
    Does that mean that whenever I use the -p flag the archive is encrypted or is it a two-part flag like

    7z -a -encrypt -pSECRET

    which would mean "-encrypt" is the command for starting an encryption with the password after -p.

    Next question: In the GUI users can choose from a drop down list the encryption method.
    Currently only AES-256 is available (in GUI).

    Is it the same in command line version?

    Do users have to pass the encryption method as well like

    7z -pSECRET -encmethod=AES256

    Assume I decrypt it later (in 5 years). Is the encryption method automatically recognized (even
    when other, additional methods were introduced meanwhile and implemented in e.g. 7zip version 11)?
    I could imagine 7zip version 11 could be confused whether the previously used encryption methdod was AES-256 or AES-512 or BLUEFISH or 3DES2048 or ....

    I need long term compatibility.

    Furthermore in GUI there is a checkbox "Encrypt file names".

    How can I enable this filename encryption in command line version too?

    Thomas

     
  • fernando
    fernando
    2013-07-29

    The below information can be obtained from the help file
    which is included with the 7-Zip distribution.

    -pSECRET encrypts archive no other parameter is required.
    AES-256 is the default (and only) cipher for 7-Zip (.7z) archive format.
    if you want "filename encryption" you want to encrypt the archive headers also.
    the parameter to use is -mhe=on (-mhe+ is equivalent).