7-Zip doesn't ask me for a password for a ZIP file I encrypted while double-clicking it

31

5

I just tried to encrypt a folder with 7-Zip by a command line, choosing a password, but when double-clicking on the ZIP file, it shows me the files list without asking any password.

Is there a way to truly encrypt a folder from the command line?

asksuperuser

Posted 2009-11-13T22:41:01.847

Reputation:

Answers

42

The ZIP format doesn't allow for encrypting file lists. This means that file lists are viewable by anyone.

Only the contents of the files is encrypted, which means that no one can read the file without your password.

Due to this, 7-Zip only asks for your password before unzipping.

If you need a format that encrypts the file list, use 7Z and make sure you check "Encrypt File Names".

For the more technical minded, the ZIP specification doesn't allow for encryption of the Central Directory.

Andrew Moore

Posted 2009-11-13T22:41:01.847

Reputation: 4 375

7

You will be prompted for a password when you try to extract the files. To simply view the contents of the archive does not require a password.

If you would like to obfuscate the contents of the archive, compress the directory into an archive, and then compress that archive with a password. Thus, you will have to extract the archive with a password, to pull out the archived (and obfuscated) contents.

JMD

Posted 2009-11-13T22:41:01.847

Reputation: 4 427

1Don't waste your CPU cycles on compression the second time round, if you can avoid it, though. – Phoshi – 2009-11-13T22:58:20.110

True enough. It's certainly easy enough to select Store for the compression mechanism on the second iteration. I have Fastest set as my default, and 7-Zip is ridiculously fast anyway. :) – JMD – 2009-11-13T23:26:40.617

3

A generalized solution that works for all zip programs (WINzip, 7-Zip, MacZip, etc.) is to simply zip it twice making sure the second time (or both) have password protected encryption.

See: Filenames display without entering the password when an encrypted Zip file is opened

Montana123

Posted 2009-11-13T22:41:01.847

Reputation: 31

2

I found your answer in Do encrypted compression containers like ZIP and 7-Zip compress or encrypt first?.

The command line switch to encrypt the headers (i.e. the file names) in 7-Zip is:

-mhe=on

Dude

Posted 2009-11-13T22:41:01.847

Reputation: 29

1

You can use GNU Tar to turn the directory into a single file, which you can then compress as a regular file with 7z. Anyone viewing the archive will just see the tar file.

MiffTheFox

Posted 2009-11-13T22:41:01.847

Reputation: 3 032

You don't need another tool; 7-Zip can also make a tar file. For instance, after choosing "Add to archive", chose "tar" for option "Archive format". There must be a similar option on the command line. – Peter Mortensen – 2016-06-11T20:01:53.020

Hi Good suggestion – None – 2009-11-14T23:52:22.500

0

Double clicking will show you the files. Now try to extract one... as I recall, that is when you'll get the password prompt.

Chris_K

Posted 2009-11-13T22:41:01.847

Reputation: 7 943

0

In case you're using Total Commander with the 7-Zip Plugin, press ALT + F5 (or Files -> Pack...) to compress files or folders, click Configure and check the box Encrypt File Headers and Names.

Other than that, Andrew Moore's answer is correct.

Molly7244

Posted 2009-11-13T22:41:01.847

Reputation: