Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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.

Solution 2:

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.

Solution 3:

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

Solution 4:

You can store secret data by encrypting it with a key generated by Android Keystore System and then storing the result whether you like.

Post a Comment for "Storing A Secret Key On Android"