Hello all Big brain developers :-)
I want to secure the shared preference data where I have AuthId of user.
public static void setUserAuthorization(Context context, String token) {
SharedPreferences sharedPreferences = context.getSharedPreferences(
MY_PREFERENCES, 0);
sharedPreferences.edit().putString(Authorization_token, token).apply();
}
public static String getUserAuthorization(Context context) {
SharedPreferences sharedPreferences = context.getSharedPreferences(
MY_PREFERENCES, 0);
return sharedPreferences.getString(Authorization_token, null);
}
The issue is ,
- List item
I don't want to call everytime for web service to get the key , decrypt data and then encrypt.
I don't want to store the key locally as that is still the same as unsecure key.
I want something like this,
- Only my application will decrypt it.
- The key will be generated by user device(without user interaction)
- Anytime the data can be decrypted by that key.
- That key cannot be android id as that is visible to any person.
Please help.
I tried Keystore but it needs android api 23 for the example given at developer site.(256 byte limit also there)
Secure preference is also issue for me as it is not working (or i don't know how to make it work)
Please help.