Reputation: 181
I am building a swift app and has user account. I need to keep their information (password) safely, I have read that using salted hash for the password is safe, but I wanted to know if it is recommended to use this and store the hashed password in my icloud kit (my dataBase)
Upvotes: 1
Views: 1415
Reputation: 6705
The recommendation if you need the original should be to store passwords in the keychain. If you only need to store a hash for verification, salt it and store it as a SHA-256 HASH (and keep the salt in the keychain, possibly the hash too).
If you need to put passwords in the database on an iOS device, and for whatever reason the Keychain won't work for you, you should use SQLCipher, and have the user enter the DB password to unlock it, rather than storing the DB key anywhere. If you go this route, use a key derivation function such as PBKDF2 on the user input.
Generally, assume that any password you store is a security issue. Try not to store them yourself at all.
Upvotes: 3