Password protect .gz folder sent from iPhone
I need to protect a file with password when I send it as email attachment from iPhone. I have zipped the file using libz.dylib zlib.h class. Basically I followed the approach discussed in http://www.cocoadev.com/index.pl?NSDataCat开发者_StackOverflow社区egory ie., to create NSDataCategory and calling zlib methods to compress the file. So I have the .gz format file as NSData and I want to protect it with a password. My question is how to protect a .gz file with a password. And I have also a basic question of how the password protection on a file work? Will it encrypt the total file with the given password or will it just act as a gate keeper to open the file?
You can't add password encryption to a .gz file, there is no support in libz. What you are thinking of is .zip tools that also add a simple layer of encryption where the password is used to decrypt the file. You might want to have a look at lzmaSDK to implement that sort of feature, I have read that it supports AES. But, be aware that adding encryption code to your iPhone app is more trouble that it is worth because then you will need to also register to export the encryption. It will significantly complicate your app release process.
精彩评论