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

Script doesn't work when signed with piped message on subkey. #16

Open
arjanvaneersel opened this issue Jul 26, 2023 · 1 comment
Open

Comments

@arjanvaneersel
Copy link

arjanvaneersel commented Jul 26, 2023

The subkey docs provides the following example to sign a message: echo "test message" | subkey sign --suri 0xc8fa03532fb22ee1f7f6908b9c02b4e72483f0dbd66e4cd456b8f34c6230b849. So I used this method to sign the PWN message.

However the script will reject the signature if it's signed like this.

If I sign and verify by piping the message then everything is ok.

echo "I LIKE WINNING! BOOOOO YAAAAAA!" | subkey verify 0xc099b2284eddb097025aadfeac01794774fa22638d72a70857906e522b37eb150612be15b4cf4f1bc46cc4e2badcbacb910a2a6c88d93c0bfa163c1f57286b87 5F97jG1ur7q2sBxL1VYJZwSJtqapL1aXovWpsrrPRa9fdvdv

Signature verifies correctly.

If I sign by piping, but verify by using the --message option (as the script does) then verification fails.

subkey verify --message "I LIKE WINNING! BOOOOO YAAAAAA!" 0xc099b2284eddb097025aadfeac01794774fa22638d72a70857906e522b37eb150612be15b4cf4f1bc46cc4e2badcbacb910a2a6c88d93c0bfa163c1f57286b87 5F97jG1ur7q2sBxL1VYJZwSJtqapL1aXovWpsrrPRa9fdvdv
Error: SignatureInvalid

However, if I sign by using --message instead of piping the text, then the script's verification does work.

I have no idea why this happens, but it might be good to stress in the documentation to sign with --message instead of how it's described in subkey's documentation.

@nuke-web3
Copy link
Contributor

nuke-web3 commented Jul 28, 2023

I suspect its related to paritytech/substrate#13258 (comment) - specifically that a newline is added or not. echo adds a new line. try printf that does not.

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