17

I have a requirement to zip up some files in Linux with 7zip using AES-256 encryption. The end user will be opening in Windows with 7zip. I'm using the following command:

7za a myfile.zip test.txt -tzip -mem=AES256 -mx9

The problem is that when I open the zip archive in Windows, the Method shows "Deflate" and does not say anything about AES-256.

7zip windows screenshot

How can I (and more importantly the end user) be sure that its using AES-256 as the encryption method?

Here is the doc on how to set the encryption method, which I believe I've set correctly.

Linux 7za version:

me@myhost~> 7za -version

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)

The Linux host is SLES 11 SP2, and for Windows I'm on Windows 7.

2
  • 1
    Did you mean to use a password? Jan 28, 2013 at 13:47
  • ah! yes I did mean to use a password. I've been testing, testing, testing, and mistakenly left that option out. Adding back in -pmypassword to the command did the trick and I can see AE-256 Deflate when opened in Windows. Can you post as an answer and I'll accept?
    – Banjer
    Jan 28, 2013 at 14:00

2 Answers 2

23

7-Zip will refuse to encrypt the data unless you provide a password, since it won't know what key you want to encrypt it with:

7za a myfile.zip test.txt -tzip -mem=AES256 -mx9 -pmypassword
3
  • Thanks. I had to add -pmypassword to the command.
    – Banjer
    Jan 28, 2013 at 14:06
  • 1
    If you want to encrypt filenames as well, see this answer: askubuntu.com/questions/928275/… Oct 10, 2017 at 8:03
  • Somebody who has time please submit a feature request to 7za to refuse creating an archive or at least print a clear warning message when command line options are used to change the encryption settings but no encryption is requested via the "-p" option. Sep 12, 2023 at 16:04
8

How can I (and more importantly the end user) be sure that its using AES-256 as the encryption method?

You can use 7z l -slt myfile.zip, it should output AES-256 (amongst other things).

If you choose the 7z format (e.g., with 7za a -t7z myfile.7z test.txt -tzip -mem=AES256 -mx9 -pmypassword), 7z l -slt myfile.7z should output 7zAES:19 (which is the same as AES-256).

https://sourceforge.net/p/p7zip/patches/25/#3da5 :

Igor Pavlov: 7zAES:19 means AES-256 + (2^19) SHA-256 iterations in password to key function.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .