swift3-如何保护密钥 [英] swift3 - How to protect secret key

查看:139
本文介绍了swift3-如何保护密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS swift 3开发的新手.现在,我正在一个需要加密,消息身份验证代码(MAC)和Hashed-base-MAC的项目中.这些算法需要密钥.我知道对代码中的键进行硬编码是不好的做法,例如:

I am new of iOS swift 3 development. Now, I am working on a project which needs encryption, message authentication code(MAC) and Hashed-base-MAC. These algorithms require secret keys. I know that it is a bad practice to hard-code the keys inside the code, like:

let key = "secretkeyabc123"

搜索并阅读了一些文章,例如:

Searched and read some articles like: In iOS, how can I store a secret "key" that will allow me to communicate with my server?

由于其他人可能会进行逆向工程,因此我正在寻找一种保护我的钥匙的方法.要求:

Since other people may perform reverse engineering, I am finding a way to protect my keys. Requirements:

  1. 不对密钥进行哈希处理.时间允许破解它,或使用哈希表和字典
  2. 可能无法连接到Internet(我的应用程序是一个脱机应用程序.如果您的答案需要连接到Internet.是的,请指出来.我会考虑的)
  3. 这是一个静态密钥.可能每月更改
  4. 这是一个对称密钥.

欢迎使用代码,概念或其他东西.谢谢!

Codes, concept or other things are welcome. Thanks!

推荐答案

检查iCloud钥匙串(基于您的标签[ios],[swift],[key]).

Check iCloud Keychain (based on your tags [ios], [swift], [key]).

它用作安全数据库,可以安全地存储包括用户网站登录密码,Wi-Fi网络密码,信用卡/借记卡管理(尽管没有CVV)和其他帐户数据在内的信息,以便快速访问和自动-当用户需要即时访问网页时,请在网页和其他地方填充.它们始终使用256位AES加密进行加密存储,存储在设备上并从iCloud在设备之间推送,并且仅在用户受信任的设备上可用.

It functions as a secure database that allows information including a user's website login passwords, Wi-Fi network passwords, credit/debit card management (though without CVV), and other account data, to be securely stored for quick access and auto-fill on webpages and elsewhere when the user needs instant access to them. They are always stored encrypted using 256-bit AES encryption, are stored on device and pushed from iCloud between devices, and only available on a user's trusted devices.

这篇关于swift3-如何保护密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆