iOS:存储非用户密码 [英] iOS: Storing Non-User password
问题描述
我需要在我的iOS应用程序中存储第三方用户名/密码,最好的和最安全的方法是什么?我的应用程序首次运行时,需要与Google的Picasa进行对话,以下载要用于该应用程序的私人图片.要与Picasa进行对话,我必须提供用户名/密码,并且代码中的存储完全不安全.
I need to store third-party username/password in my iOS application, what is the best and most secure way to do this? When my app first runs, it will need to talk to Google's Picasa to download private pictures to use for the app. To talk to Picasa, I have to provide my username/password and storing in the code is not secure at all.
我已经在网上搜索了,发现很多 Keychain
出现了,但是如何准确地将密码预加载到 keychain
中?
I've search the web, I see Keychain
came up a lot, but how exactly do I pre-load my password into keychain
?
xCode中是否有一个配置文件可以存储Web服务所需的密码?
Is there a configuration file in xCode somewhere to store passwords needed for web-services?
谢谢
推荐答案
认为您需要以加密形式存储密码.选择一些加密算法,生成加密的详细信息.并且在代码中有一些方法可以在需要时对其解密.
Think that you need to store the password in encrypted form. Pick some encrypting algorithm, generate the encrypted details. And in code have some method to decrypt it when needed.
您只是不希望会以纯文本形式读取您的代码的人看到密码.
You just don't want someone who would read your code as plain text to see the password.
认为将密码拆分为单独的字符串,然后再将其组合在一起就可以了.
Think that something as simple as splitting the password into separate strings and later joining them could be enough.
例如,您在此处使用代码"My1Password"进行了加密:
Here for example You have encrypted in code "My1Password":
#define R1 @"My"
#define R2 @"Password"
+ (NSString *)generatePass{ return [NSString stringWithFormat:@"%@%@%@, R1, @(1), R2]; }
这篇关于iOS:存储非用户密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!