What is the best way to use SharedPreferences to store a login / password or authorization token? I want to protect them at least a little from unauthorized access.
1 answer
- Password can not be stored
- If you decide to keep the password all the same, see item 1
- If you really really want to read below:
It is necessary to store:
String hashString=hash(password+salt); Where:
salt random string generated by cryptoresistant RNG
hash() - a crypto - resistant hash algorithm - best iterative something like 100k iterations
It is necessary to store hashString and salt
- No, the password is not in the application, the password to the server. Old legacy. No tokens. The user will indicate it once, but then you need to remember, because asking every time is not an option at all. I remembered, we in a similar case made a pin and a symmetric algorithm, anything better than nothing. It will be necessary to look at the work with the fingerprint scanner while I know nothing about it. - tse
- Your answer, which pavlofff pointed out to me, is more into the subject. - tse
- In the specified context, the option in the old answer is more efficient - this is yes. Only it is necessary to store not a password - but a key / token - Barmaley
|
javax.criptopackage, Android has its own Android systemAndroid Keystore/ there is another answer - pavlofff