Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Cant get decrypted value #76

Open
1mohammad7 opened this issue Jan 25, 2018 · 0 comments
Open

Cant get decrypted value #76

1mohammad7 opened this issue Jan 25, 2018 · 0 comments

Comments

@1mohammad7
Copy link

I'm sorry but your explanation and sample project are very vague and can't figure it out. Could you please explain how to get data from encrypted sharedPrefs?!
What is wrong with this code? it's like your sample project but the value won't be decrypted! :

//Set data
   SecurePreferences sharedPrefs = new SecurePreferences(context, password, "vault");
  SecurePreferences.Editor editor = sharedPrefs.edit();
  editor.putString(KEY_USERNAME, username);
 editor.commit();

//Get decrypted data (WONT WORK)
 SharedPreferences securePreferences = context.getSharedPreferences("vault", Context.MODE_PRIVATE);
        for (Map.Entry<String, ?> entry : securePreferences.getAll().entrySet()) {
            String key = entry.getKey();
            if (key.equals(SecurePreferences.hashPrefKey(KEY_USERNAME))) {
                MY_USERNAME = securePreferences.getString(key,""); //Returns encrypted value
            }
        }
@1mohammad7 1mohammad7 changed the title Cant get decryped value Cant get decrypted value Jan 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant