iOS 中关于加密的困惑

发布于 2024-12-22 12:17:56 字数 447 浏览 4 评论 0原文

我是一个非常新的程序员,试图编写一些 iOS 程序,当我到达必须加密数据的部分时,我遇到了一堵模糊且记录不详的墙。苹果显然提供了加密数据所需的所有工具,但没有在任何地方提及它。目前我正在尝试 https://github.com/AlanQuatermain/aqtoolkit 中找到的东西,这显然有效。但是,我读到 http://robnapier.net/blog/aes-commoncrypto-564 不应使用用户选择的密码作为加密密钥,但我看到了一些人们直接在该库和其他库中使用用户密码的示例。这是否适用于这里,我应该在使用用户密码之前通过一个小的跨栏比赛来运行它吗?

I'm a very newb programmer trying to write some iOS programs, and when I reached the part where I must encrypt my data, I ran into a misty and ill-documented wall. Apple apparently provides all the tools one needs to encrypt data but doesn't write about it anywhere. Currently I am experimenting with stuff found in https://github.com/AlanQuatermain/aqtoolkit, which apparently work. However, I read in http://robnapier.net/blog/aes-commoncrypto-564 that one should not use user selected passwords as encryption keys, but I have seen a few examples of people using the user's password directly with this library and others. Does this apply here, and should I run the user password through a small hurdle race before using it?

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

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

发布评论

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

评论(1

养猫人 2024-12-29 12:17:56

使用密码的哈希值作为加密例程的密钥是一个好主意。原因之一是不同的算法可能需要不同长度的密钥,通过选择适当的哈希算法(例如 AES256 的 SHA256),您会自动获得具有适当长度的密钥。

It is a good idea to use the hash of a password as a key for your crypto routines. One reason for that is that different algorithms may need keys of a different length and by selecting the appropriate hashing algorithm (e.g. SHA256 for AES256) you automatically get a key with the appropriate length.

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