Skip to content

Instantly share code, notes, and snippets.

@ed-george
Created June 4, 2022 00:07
Show Gist options
  • Save ed-george/29ff79b92569c4de1543222b95ff2465 to your computer and use it in GitHub Desktop.
Save ed-george/29ff79b92569c4de1543222b95ff2465 to your computer and use it in GitHub Desktop.
Unpacking Android Security: Part 2 - Insecure Data Storage (Example 2)
val masterKey = MasterKey.Builder(this)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build()
EncryptedSharedPreferences.create(this, "myEncryptedPrefsFile", masterKey, PrefKeyEncryptionScheme.AES256_SIV, PrefValueEncryptionScheme.AES256_GCM).edit {
putString("mySecretKey", "mySecretValue")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment