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

signMessage returns different results #8

Open
h3ku opened this issue Nov 22, 2021 · 3 comments
Open

signMessage returns different results #8

h3ku opened this issue Nov 22, 2021 · 3 comments

Comments

@h3ku
Copy link

h3ku commented Nov 22, 2021

Shouldn't a call to sign message with exactly the same message return the
same signature?

@h3ku h3ku changed the title Different results same call to 'signMessage' 'signMessage' method does not respect standard Nov 22, 2021
@rjchow
Copy link
Owner

rjchow commented Nov 22, 2021 via email

@h3ku
Copy link
Author

h3ku commented Nov 22, 2021

For example when calling signMessage with ethers Wallet provider the results is always the same.

Same thing when using https://www.myetherwallet.com/wallet/ to sign a message.

@h3ku h3ku changed the title 'signMessage' method does not respect standard signMessage returns different results Nov 22, 2021
@h3ku
Copy link
Author

h3ku commented Nov 22, 2021

After having a look today it seems that the problem is the following.

When doing ECDSA a random k value is generated to do the multiplication of the elliptic curve, this means that signing the same message will return different values.
However some libraries (Not all, there is no a clear standard across the Ethereum ecosystem from what I know) implement RFC 6979 which generate a "constant" k value, effectively getting the same signature when signing the same message multiple times.

I contacted AWS to see if there is a way to make KMS use RFC 6979 but not sure if thats going to be possible.

More info: https://medium.com/mycrypto/the-magic-of-digital-signatures-on-ethereum-98fe184dc9c7

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

No branches or pull requests

2 participants