开发者

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开发者_StackOverflow 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.


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


That looks like something you want:

http://www.artpol-software.com/ZipArchive/API/classCZipFileHeader.aspx#0b3983cef7d3d4e2a7dff403e88b8883

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜