Skip to content

Add example for showing how to store encryption key#4181

Open
beeender wants to merge 13 commits intomainfrom
feature/example/store_password
Open

Add example for showing how to store encryption key#4181
beeender wants to merge 13 commits intomainfrom
feature/example/store_password

Conversation

@beeender
Copy link
Copy Markdown
Contributor

No description provided.

@Zhuinden
Copy link
Copy Markdown
Contributor

Is this related to https://github.com/realm/realm-android-user-store ?

@cmelchior
Copy link
Copy Markdown
Contributor

Not really, although it uses the same concept. The idea is to show how to use a double layered key approach to store Realm encryption keys since the keystore does not allow you to extract the key material again, which is required by Realm.

So you

  1. Create a keystore and secure it using a fingerprint (because it's fun/easy to show, but you can use pin or whatever)

  2. Then create a AES key outside the keystore and put the key inside the keystore. From the keystores point of view it will just see random bytes which it stores quite fine.

  3. Show that on startup you can use the fingerprint to get the Realm key out of the keystore again and you can now use it to unlock the Realm.

This works quite nicely offline and is secure if you trust that the keystore does its job correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants