Skip to content

Conversation

@kirk-baird
Copy link
Member

@kirk-baird kirk-baird commented Nov 18, 2020

Issue Addressed

Closes #1889

Proposed Changes

  • Error when passwords which use invalid UTF-8 characters during encryption.
  • Add some tests

Additional Info

I've decided to error when bad characters are used to create/encrypt a keystore but think we should allow them during decryption since either the keystore was created

  • with invalid UTF-8 characters (possibly by another client or someone whose password is random bytes) in which case we'd want them to be able to decrypt their keystore using the right key.
  • without invalid characters then the password checksum would almost certainly fail.

Happy to add them to decryption if we want to make the decryption more trigger happy 😋 , it would only be a one line change and would tell the user which character index is causing the issue.

See https://eips.ethereum.org/EIPS/eip-2335#password-requirements

Signed-off-by: Kirk Baird <baird.k@outlook.com>
@kirk-baird kirk-baird added A0 bug Something isn't working crypto An issue/PR that touches cryptography code. ready-for-review The code is ready for review and removed bug Something isn't working crypto An issue/PR that touches cryptography code. labels Nov 18, 2020
Signed-off-by: Kirk Baird <baird.k@outlook.com>
Signed-off-by: Kirk Baird <baird.k@outlook.com>
Signed-off-by: Kirk Baird <baird.k@outlook.com>
Signed-off-by: Kirk Baird <baird.k@outlook.com>
Copy link
Member

@paulhauner paulhauner left a comment

Choose a reason for hiding this comment

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

Glorious!

we should allow them during decryption since either the keystore was created

I agree, I don't see the harm in decrypting using invalid chars.

bors r+

@paulhauner paulhauner added ready-for-merge This PR is ready to merge. and removed ready-for-review The code is ready for review labels Nov 19, 2020
bors bot pushed a commit that referenced this pull request Nov 19, 2020
## Issue Addressed

Closes #1889 

## Proposed Changes

- Error when passwords which use invalid UTF-8 characters during encryption. 
- Add some tests

## Additional Info

I've decided to error when bad characters are used to create/encrypt a keystore but think we should allow them during decryption since either the keystore was created
-  with invalid UTF-8 characters (possibly by another client or someone whose password is random bytes) in which case we'd want them to be able to decrypt their keystore using the right key.
-  without invalid characters then the password checksum would almost certainly fail.

Happy to add them to decryption if we want to make the decryption more trigger happy 😋 , it would only be a one line change and would tell the user which character index is causing the issue.

See https://eips.ethereum.org/EIPS/eip-2335#password-requirements
@bors
Copy link

bors bot commented Nov 19, 2020

@bors bors bot changed the title Reject invalid utf-8 characters during encryption [Merged by Bors] - Reject invalid utf-8 characters during encryption Nov 19, 2020
@bors bors bot closed this Nov 19, 2020
@paulhauner paulhauner deleted the eip2335-password-control-characters branch March 17, 2021 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A0 ready-for-merge This PR is ready to merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing EIP-2335 control code removal

3 participants