Z S
Z S

Reputation: 7489

check if a zip file has password-protection, in objective-c

I have used ZipArchive library to zip and unzip files, but it doesn't give a clue about how to check if the zip file is password-protected. I need to be able to check whether a .zip file is password-protected. If it is, I will prompt the user for a password; otherwise just unzip it.

Anyone have an idea of how to check this? Is there an encryption bit on the file that I can test for? If so, how would I do it? Thanks.

Upvotes: 1

Views: 1202

Answers (2)

Nickolay Olshevsky
Nickolay Olshevsky

Reputation: 14160

Yes, you can check zip local file header for a encryption flag. However, this will need some data parsing.

Upvotes: 1

Related Questions