3

I am looking for the bit flags to detect the file is password-protected, not a regular .zip or .rar.

1
  • What OS/environment/language are you on? Do you want to be able to figure this out from the shell, programmatically, etc.? Jul 30, 2010 at 21:09

2 Answers 2

3

You can use zipinfo and unrar to test whether a ZIP file is encrypted. E.g.:

zipinfo -v file.zip |grep 'file security status:\s*encrypted'
unrar v -p- file.rar 2>&1|grep 'Encrypted file'
1

You can read about the header structure of rar here

And about the zip header structure here

It helps to download the source code of opensource unpackers to read some code examples.

You must log in to answer this question.

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