Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add encrypted client data support #88

Merged
merged 32 commits into from Jan 27, 2021
Merged

Add encrypted client data support #88

merged 32 commits into from Jan 27, 2021

Conversation

jgriffiths
Copy link
Contributor

Adds support for end-to-end encrypted client data (a 'client blob'), cached locally and backed up/synchronized between wallet installs using the Green backend servers. The Green servers do not and cannot know the contents of the users data, nor can they attempt to maliciously modify it, downgrade it to an earlier version, or censor it without the users wallet detecting it.

On connecting with a client blob enabled wallet, any existing tx memos and subaccount names are migrated into the client blob. New wallets will use the blob from wallet creation. Once the blob is initialized, memos and names are never passed to the server except inside the encrypted blob.

A backend server job will periodically remove the memo and subaccount name data from the backend for wallets that have upgraded. Once a user has set their client blob, the server allows logins only from blob-enabled wallets, and rejects any attempts to store memos/names unencrypted using the existing API end points.

…oaded

This process is very expensive on low powered hardware so this should
result in a better user experience, particularly as we use the cache
more.
We use a single derivation for both as follows, given a privately
derived pub key P:

- TMP_KEY = HMAC_SHA512(P, PASSWORD_SALT, 2048)
- AES_KEY = SHA256(TMP_KEY[:32])
- HMAC_KEY = TMP_KEY[32:]
These implementations differ from the existing cache ones in that they
operate directly on memory buffers.
When getting or setting values from the blob, load it if its obsolete.
This mostly eliminates failed server blob saving attempts, and ensures
we always fetch the most recent data from it.
Also share the code to retry blob updates.
Its not going to be possible to store for better compression and also
keep the client blob backwards compatible, so remove that FIXME.
This prevents the server from returning old client blobs.
Without this terminate() is called when these exceptions fire.
@jgriffiths jgriffiths merged commit bd0fe78 into master Jan 27, 2021
@jgriffiths jgriffiths deleted the green_ss_to_merge branch January 27, 2021 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant