Storing a secret key on Android
My Android application uses a secret key to generate a token for authentication purposes. Is there a more secure way to store this than just putting this in the data store? I think for the iPhone, we store it in the keychain. I am aware of android.accounts.AccountManager, but this seems to give other applications potentially the ability to access the password (if the user selects the wrong option) and so seems less secure.
4 Solutions collect form web for “Storing a secret key on Android”
Android (unfortunately) does not provide a way to do so. The approach I’ve used before is to encrypt this token with another key generated within the app.
Your app key can be algorithmically generated. This, however, is only as secure as your algorithm. Once that is known this is equivalent to storing the token in plain text.
You can store the key in the Preferences of your App. This will protect the key from getting read by other applications because of the underlying file system restrictions of the Android system.
But this won’t protect the key from being read by the user itself.
if you can run apk tool then its in debug and you are going to root the device. There isn’t any more protection on the keychain in iOS when its jailbroken
You can store secret data by encrypting it with a key generated by Android Keystore System and then storing the result whether you like.