Reputation: 775
I am encrypting the shared preferences with this code:
String masterKeyAlias = MasterKeys.getOrCreate(MasterKeys.AES256_GCM_SPEC);
SharedPreferences sharedPreferences = EncryptedSharedPreferences.create(
"secret_shared_prefs",
masterKeyAlias,
context,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
);
// use the shared preferences and editor as you normally would
SharedPreferences.Editor editor = sharedPreferences.edit();
Taken from this answer. I would like to know a programmatically method to check if the data is success encrypted. I try the above code to encrypt the shared preferences and don't show me any error.
Upvotes: 2
Views: 926
Reputation: 1232
You can implement the stetho library to view sharepreferences and many more things, such as databases or http calls, from the web browser.
Too easy
http://facebook.github.io/stetho/
Upvotes: 2
Reputation: 869
From Android Studio, start Android Device Monitor, go to File Explorer,
and browse "/data/data/< name of your package >/shared_prefs/".
You will find the preferences XML there... and also you can copy it for inspection. you can see the xml contents (encrypted or decrypted)
Upvotes: 3