Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
    
What OS/environment/language are you on? Do you want to be able to figure this out from the shell, programmatically, etc.? –  Matthew Flaschen Jul 30 '10 at 21:09

2 Answers 2

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'
share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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