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

Allow accounts to be individually encrypted and unlocked #1823

Merged
merged 2 commits into from
Oct 6, 2020

Conversation

jrick
Copy link
Member

@jrick jrick commented Aug 19, 2020

This commit introduces three new RPCs (setaccountpassphrase,
unlockaccount, and lockaccount) which can be used to set a unique
passphrase for and allow individual locking of particular accounts,
separate from the global keys used to encrypt all other accounts.

Argon2id is used as the KDF for individually encrypted accounts, and
XChaCha20-Poly1305 is used for authenticated encryption of account
xprivs. The new KDF parameters use the same memory difficulty (256M)
as the scrypt parameters used for all other accounts.

Copy link
Member

@vctt94 vctt94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I set the account passphrase and looks like it worked, but if I unlock the account and try sending from it, I get a wallet passphrase error:

vctt@vctt:~/projects/decred/dcrctl$ go build && ./dcrctl --testnet --wallet unlockaccount default 123
vctt@vctt:~/projects/decred/dcrctl$ go build && ./dcrctl --testnet --wallet sendfrom default TsfDLrRkk9ciUuwfp2b8PawwnukYD7yAjGd 1
-13: enter the wallet passphrase with walletpassphrase first

Copy link
Member

@vctt94 vctt94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and worked fine. LGTM.

One thing I noticed is that right now is not possible to know which accounts is locked or not, or an easy way to lock all accounts.

I think it would be nice to have it.

@jrick
Copy link
Member Author

jrick commented Sep 9, 2020

That's a good suggestion. Unfortunately the most sensible RPC to add this to (listaccounts) would need a breaking change to the response format to support something like this.

@jrick
Copy link
Member Author

jrick commented Sep 9, 2020

the account properties (returned by w.Accounts) now includes if the account has a per-account passphrase set on it, and whether it is locked or unlocked, which should be useful for the grpc server since it does return this data directly (unlike jsonrpc).

@jrick jrick force-pushed the accountencryption branch 2 times, most recently from c203d20 to 9763fe4 Compare September 9, 2020 16:28
@jrick jrick force-pushed the accountencryption branch 3 times, most recently from 3007699 to 82e422e Compare September 22, 2020 13:58
jrick and others added 2 commits October 5, 2020 20:04
This commit introduces three new RPCs (setaccountpassphrase,
unlockaccount, and lockaccount) which can be used to set a unique
passphrase for and allow individual locking of particular accounts,
separate from the global keys used to encrypt all other accounts.

Argon2id is used as the KDF for individually encrypted accounts, and
XChaCha20-Poly1305 is used for authenticated encryption of account
xprivs.  The new KDF parameters use the same memory difficulty (256M)
as the scrypt parameters used for all other accounts.
@jrick jrick merged commit 88b3d61 into decred:master Oct 6, 2020
@jrick jrick deleted the accountencryption branch October 6, 2020 14:10
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

2 participants