在 iPhone 上除了 CommonCrypto 之外还有什么替代方案?

发布于 2024-10-04 14:48:04 字数 270 浏览 3 评论 0原文

准备将我的应用程序提交到 Apple 的 Itunes 商店,并在提交过程中对一个问题感到困惑:“出口法要求包含加密的产品获得适当的出口授权……您的产品使用加密吗?”

我使用 CommonCrypto CommonCryptor.h 对设置文件进行编码,以防止其未经授权的修改。 所以现在我不确定是否必须完全删除所有加密并基本上按原样保留 xml 文件,还是应该使用其他方法来保护该文件。 我还可以使用哪些其他简单的保护机制来保护它,同时不使用任何加密,以便我可以提交我的应用程序而无需大量额外的文书工作?

Getting ready to submit my app to the Apple's Itunes store and got puzzled by a question during the submission process: "Export laws require that products containing encryption be properly authorized for export...... Does your product use encryption?"

I've used CommonCrypto CommonCryptor.h to encode settings file against its unauthorized modifications.
So now I'm not sure if I have to remove all the encryption completely and leave just an xml file basically as is or should I use some other method to protect the file.
What other simple protection mechanisms I can use to protect it and at the same time do not use any encryption so I can submit my app without tons of extra paperwork?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一瞬间的火花 2024-10-11 14:48:04

您对“加密”的使用不受美国出口规则的约束,因为它不是为了“信息安全”(我认为您回答“是,是,是,否”左右,ICBW,否则他们可能会更改顺序)。本质上,如果它不能阻止美国国家安全局监视你,他们很乐意让你使用它。

然而,加密传统上提供机密性,而不是消息完整性。如果你想确保用户没有篡改设置文件(例如通过编辑iPhone备份),只需用MAC保存即可。也就是说,

  1. 生成 MAC 密钥(从 /dev/random 中取出一些字节)。
  2. 保存文件时计算文件的 MAC(请参阅 Objective-C 示例代码HMAC-SHA1; 请注意,接受的答案实际上是 HMAC-SHA-256)
  3. 将 MAC 附加到文件末尾(或将其设置为文件属性,或将其粘贴到另一个文件中)。
  4. 读取时,计算文件的 MAC 并验证它是否是您保存的文件。如果将其附加到文件中,则必须删除最后几个字节(例如 [NSData dataWithContentsOfFile:path],然后 -subdataWithRange: 两次才能获取“消息” ”和 MAC,然后验证 MAC,如果验证成功,则解析“消息”。

它不会阻止某人使用越狱手机从您的二进制文件中提取 MAC 密钥,但不会太多。它也不会阻止某人读取明文设置文件,但这可能不是一个问题,

如果您在您控制的计算机上生成该文件(例如,它是从服务器下载的文件),那么从技术上讲,RSA 签名验证是等效的。加密,但我认为它不算是用于导出目的的加密(如果是的话,它是用于“身份验证”目的,但仍然不算加密)(我认为,它背后的数学原理)。超出了我的想象),也应该没问题。

Your use of "encryption" is not subject to US export rules because it's not for "information security" (I think you answer "yes, yes, yes, no" or so, ICBW, or they could have changed the order). Essentially, if it doesn't stop the NSA from spying on you, they're happy to let you use it.

However, encryption traditionally provides confidentiality, not message integrity. If you want to ensure that the user hasn't tampered with the settings file (e.g. by editing the iPhone backup), just save it with a MAC. That is,

  1. Generate a MAC key (pull some bytes out of /dev/random).
  2. Calculate the MAC of the file when you save it (see Objective-C sample code for HMAC-SHA1; note that the accepted answer is actually HMAC-SHA-256)
  3. Append the MAC to the end of the file (or set it as a file attribute, or stick it in another file).
  4. When reading, calculate the MAC on the file and verify that it's the one you saved. If it's appended to the file, you'll have to remove the last few bytes (e.g. [NSData dataWithContentsOfFile:path], then -subdataWithRange: twice to get the "message" and MAC, then verify the MAC, and parse the "message" if verification succeeds.

It won't stop someone with a jailbroken phone from extracting the MAC key from your binary, but not much will. It also won't stop someone from reading the plaintext settings file, but that might not be such a problem.

If you're generating the file on a computer you control (e.g. it's a file downloaded from a server), then sign it. Technically, RSA signature validation is equivalent to encryption, but I don't think it counts as encryption for export purposes (if it does, it's for "authentication" purposes and still doesn't count). DSA signature validation isn't encryption (I think, the math behind it went way over my head) and should also be fine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文