Whats the Correct Way to Prompt a User for their Password?

我的未来我决定 提交于 2019-12-13 18:51:58

问题


This is a follow up to this question.

If I'm going to store a user's username and password with Keychain Services, should I simply create my own prompt view with an NSSecureTextField for the password, and then once the user enters their info pass it to a Keychain Services API (I found this one)?

I'm concerned Apple won't like me interacting with a users sensitive data directly like that.


回答1:


this sounds like the appropriate thing to do. The following function calls will do the stuff you need.

SecKeychainAddGenericPassword();
SecKeychainFindGenericPassword();
SecKeychainItemModifyAttributesAndData();
SecKeychainItemCopyContent();
SecKeychainItemFreeContent();
SecKeychainItemDelete();



回答2:


It appears that the only way use a user's password for Apple's Autoingest tool is to handle the password directly in code. I make sure to not hold onto it longer than I need it, and of course I store it with Keychain Services in order to keep it secure.



来源:https://stackoverflow.com/questions/12503708/whats-the-correct-way-to-prompt-a-user-for-their-password

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!