What is the most appropriate way to store user settings in Android application

后端 未结 14 2406
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 05:38

I am creating an application which connects to the server using username/password and I would like to enable the option \"Save password\" so the user wouldn\'t have to type

14条回答
  •  感动是毒
    2020-11-22 06:06

    I use the Android KeyStore to encrypt the password using RSA in ECB mode and then save it in the SharedPreferences.

    When I want the password back I read the encrypted one from the SharedPreferences and decrypt it using the KeyStore.

    With this method you generate a public/private Key-pair where the private one is safely stored and managed by Android.

    Here is a link on how to do this: Android KeyStore Tutorial

提交回复
热议问题