密码保护从 iPhone 发送的 .gz 文件夹
当我从 iPhone 作为电子邮件附件发送文件时,我需要使用密码保护该文件。我已使用 libz.dylib zlib.h 类压缩该文件。基本上我遵循 http://www.cocoadev.com/index.pl?NSDataCategory< 中讨论的方法/a> 即创建 NSDataCategory 并调用 zlib 方法来压缩文件。所以我有 .gz 格式文件作为 NSData,我想用密码保护它。我的问题是如何使用密码保护 .gz 文件。我还有一个基本问题:文件的密码保护如何工作?它会使用给定的密码加密整个文件还是仅充当打开文件的看门人?
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?NSDataCategory 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法向 .gz 文件添加密码加密,libz 不支持。您想到的是 .zip 工具,它还添加一个简单的加密层,其中密码用于解密文件。您可能想看看 lzmaSDK 来实现此类功能,我读到它支持 AES。但是,请注意,向 iPhone 应用程序添加加密代码会带来更多麻烦,因为这样您还需要注册才能导出加密。它将使您的应用程序发布过程显着复杂化。
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.