How to encrypt txt files with AES256 via Windows 7z command line?

4

3

I have 7z on windows , and I want to encrypt 1 txt file with AES256 via 7z command line.

How can I do it please?

g319909.nwytg.coM

Posted 2018-11-21T21:32:15.773

Reputation: 41

Answers

4

To make the answer simple just use the switch ( -p ) which means Set Password with the default encryption which is AES

example:  7z a -p Zip_File_Name File_2_zip.txt

7zip will encrypt the file or folder and prompt for a password.

or use

example 7z a -pPassword Zip_File_Name.7z File_2_Zip.txt

This example will auto add the password to the file for you.

The other switches used above are

7z a -p -mhe=on Zip_File_Name.7z File_2_Zip.txt

 -pPassword   ==  Auto add password without being prompted
 -mhe=on      ==  Means to encrypt the file names in archive too.

Jason Swartz

Posted 2018-11-21T21:32:15.773

Reputation: 41

0

7za u -mx -mhe -pPASSWORD ARCHIVE-FILE-NAME.7Z SOURCE-FILE-SPEC

Any time you use the .7z format, the file is AES-256 encrypted.

K7AAY

Posted 2018-11-21T21:32:15.773

Reputation: 6 962

Can you please explain me what is the arguments u and mx and mhe ? Thank you – g319909.nwytg.coM – 2018-11-22T04:14:01.723

One issue per question, please, as per house rules. https://www.dotnetperls.com/7-zip-examples offers details.

– K7AAY – 2018-11-22T23:28:42.160

2

Is it documented somewhere? I can see that the -mem switch (EncryptionMethodID) is available for zip type. Documented here: https://sevenzip.osdn.jp/chm/cmdline/switches/method.htm - but the documentation does not say anything about the cipher used for other types. So how do you know?

– nagylzs – 2019-11-13T17:16:50.140