After reading the question and answers of this and this, I left with an overall impression from the last one that zips were considered not safe and insecure way of sharing data.
I still think password-protected compressed files can be made secure. So let me get this straight with this very
Specific scenario
- You're using the
7z
command, version 9 or above, in a Linux machine. Notzip
. Notrar
. - Correct me if I'm wrong, but 7z uses AES-256 by default when password protected, no matter if the archive format is going to be
.zip
or.7z
You want to create a self-extract file
archive.exe
from directorydir1
and want all filenames contents and names and all headers to be encrypted, so you run7z a -mhe=on -psecretpassword -sfx archive.exe dir1
- The password used was very strong, assume entropy enough
- You securely shared the password with the file's intended recipient. Only you two know the password
- You also securely share the archive's
SHA1
hash - You now make this file available for the person to download
I say that
- The person can extract this archive even in a Windows machine without any program just with knowledge of the password
- The names of the files in encrypted directory
dir1
cannot be read if you don't know the password - The archive cannot be tampered with file substitution because filenames and headers were also encrypted
- Any tempering would be noticed if the person checked the
SHA1
after downloading - In terms of confidentiality of file names and contents, this is as secure as compressing the directory with anything (zip, rar, tar.gz) and applying
openssl aes-256-cbc
on it - The self-extraction adds no vulnerability, and if it did, simply removing the
-sfx
or changing it to-t7z
would fix it, though in this case the person would need 7-zip to extract it
Correct or not?