将NSUserDefaults转换为钥匙串? [英] Converting NSUserDefaults to Keychain?

查看:80
本文介绍了将NSUserDefaults转换为钥匙串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,NSUserDefaults非常易于使用.但是显然,它不是太安全-没有加密.当然,客户端希望应用程序安全,因为它包含敏感数据.

So, NSUserDefaults is quite easy to use. But apparently, it is not too secure - there is no encryption. And of course the client wants the app prefs to be secure because it contains sensitive data.

但是钥匙链是安全的,尽管很难编码(显然).那么有没有一种方法可以轻松地将NSUserDefaults代码转换为Keychain代码?换句话说,我想将应用程序偏好存储在钥匙串中.还是我吠错了树?

But the Keychain is secure, though hard to code (apparently). So is there a way to easily convert NSUserDefaults code to Keychain code? In other words, I want to store app prefs within the Keychain. Or am I barking up the wrong tree?

推荐答案

以下两种解决方案都是KeyChain API的包装器.通过在NSUserDefaults类别中使用它们,您可以拥有一种干净的方法来访问和存储密码.

Both of the below solutions are wrappers around KeyChain API. By using them in a NSUserDefaults category, you can have clean way to access and store passwords.

您可以尝试 EMKeyChain 库,该库以友好的方式包装了钥匙串.如果您需要存储密码,则就像NSUserDefaults一样简单.

You can try the EMKeyChain library that wraps the keychain in a friendly manner. If you need to store passwords, it is as simple as NSUserDefaults.

有一个简单的包装器:简单的iPhone钥匙串代码.

There is a simple wrapper: Simple iPhone Keychain Code.

这篇关于将NSUserDefaults转换为钥匙串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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