How can I zip all files in a directory without compression and using AES256 from a Debian Terminal?

I have a folder. I want to zip all files in it without compression.





I do NOT want to create a zipped compressed directory from many files. Rather all files should be zipped individually. Also they should be encrypted using AES256.

  • Why do you want to zip them at all? Would it not be better to use openssl to do the encryption on them? – Kusalananda Nov 5 '18 at 9:52
  • To zip and then encrypt is not wise from security point of view. You will give attacker several known bytes from the begin of the file. Better just encrypt them. – Romeo Ninov Nov 5 '18 at 10:07

Info-Zip’s zip itself doesn’t (yet, but don’t hold your breath) support AES encryption, but 7-zip does:

7z a -mx=0 -mem=AES256 -p archive.zip file1 file2

will prompt for a password, and store file1 and file2, uncompressed, encrypted using AES-256, in archive.zip. On Debian, 7z is available in the p7zip-full package.

The resulting archive won’t be extractible using Info-Zip’s unzip; you’ll need 7-zip, or another PK5.1-compatible extractor.

Applying this to your example:

for file in File*; do 7z a -mx=0 -mem=AES256 -p "${file}.zip" "${file}"; done

(you can specify the password to use after the -p option, assuming you trust everything that’s running on your system and any other users who might be connected).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.