Encryption help - Command line

Help
2008-11-29
2012-12-07
  • William Saywell

    William Saywell - 2008-11-29

    Hi,

    I need to add all the files in a folder to a self-extracting exe archive using AES256 encryption, and also set a password.

    I tried

    "c:\program files\7-zip\7z.exe" a -sfx7z.sfx -tzip encrypted.exe * -ppassword -mem=AES256

    Which creates a nice self-extracting exe but I can open it with 7-zipithout needing a password.

    I've obviously got something wrong in the -m command, but the help file isn't very helpful as to how exactly it should be done.

    Suggestions welcomed!

    Thanks,

    William

     
    • fernando

      fernando - 2008-11-29

      I do not know what you make of file encrypted.exe
      Switch -tzip is not compatable with switch -sfx
      7z format and switch -p will encrypt with AES256

      Do like:
      "c:\program files\7-zip\7z.exe" a -ppassword -sfx7z.sfx encrypted.exe *

      Or for encrypt filnames also, do like:
      "c:\program files\7-zip\7z.exe" a -mhe=on -ppassword -sfx7z.sfx encrypted.exe *

      See:

      $ 7z a -mhe=on -ppassword -sfx7z.sfx encrypted.exe *

      7-Zip 4.61 beta  Copyright (c) 1999-2008 Igor Pavlov  2008-11-23
      Scanning

      Creating archive encrypted.exe

      Compressing  example1.dat

      Everything is Ok

      $ 7z l -slt encrypted.exe

      7-Zip 4.61 beta  Copyright (c) 1999-2008 Igor Pavlov  2008-11-23

      Enter password:password

      Listing archive: encrypted.exe

      Method = LZMA 7zAES
      Solid = -
      Blocks = 1
      Physical Size = 1588089
      Headers Size = 201
      Offset = 139776
      ----------

      Path = example1.dat
      Size = 1605444
      Packed Size = 1587888
      Modified = 2008-11-29 10:37:45
      Attributes = ....A
      CRC = D806AB22
      Encrypted = +
      Method = LZMA:21 7zAES:19
      Block = 0

      $

       
      • William Saywell

        William Saywell - 2008-11-30

        Thanks.

        Are you sure that "7z format and switch -p will encrypt with AES256" is correct, and it's not just setting a password for extraction rather than actually encrypting the files? 

        The 7-zip help makes no mention of this - the only mention of AES256 seems to be in the -m section, with em=AES256 (though it doesn't describe the correct syntax for using -m and em=AES256).

        It's important, as the files to be created MUST be encrypted by AES256.

        Regards,

        William

         
    • William Saywell

      William Saywell - 2008-11-30

      OK, I've found confirmation via Google!
      If only the documentation was as good as the application!

      Next question:

      Is it possible to suppress the dialogue box asking which directory to extract into?
      I need it to extract to the directory it's in - ie the default setting.
      Thanks again,

      William

       
      • fernando

        fernando - 2008-11-30

        Do like:
        "c:\program files\7-zip\7z.exe" a -ppassword -sfx encrypted.exe *

        Or for encrypt filnames also, do like:
        "c:\program files\7-zip\7z.exe" a -mhe=on -ppassword -sfx encrypted.exe *

         
    • William Saywell

      William Saywell - 2008-11-30

      Thanks - that works well.

      William

       

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks