-
Notifications
You must be signed in to change notification settings - Fork 389
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
[gnokey] Verify
and Sign
function are not harmonious
#2311
Comments
I changed the
the Im now confusing another way to get the |
I can reconstruct the |
Verify
and Sign
functions now are not a pairVerify
and Sign
function are not harmonious
This issue is stale because it has been open 6 months with no activity. Remove stale label or comment or this will be closed in 3 months. |
Description
Start from this disscusion, I dive into gnokey command and find out somethings that weird with
Sign()
andVerify()
cc: @zivkovicmilos @leohhhn
Definition:
Verify
: To verify a transaction signature is correctSign
: To Sign the document.Lets say we save our transaction into
file.tx
.Then sign it with:
There is a
tx.GetSignBytes()
that is used insideSign()
gathers arguments from command, in thesignOptions
:Then adds some informations of tx:
tx.Fee
,tx.Msgs
,tx.Memo
(from thefile.tx
) to contruct aSignDoc
data.This
SignDoc
data will be sorted and marshaled to a []bytesignBytes
message.The
sign()
function will take this final message as a message to sign.Then the
sign()
signs this msg, with the corresponse keys, and then writes it (append) into the originialfile.tx
.Problems:
The problem is here. The
Verify()
now take the wholefile.tx
after signed as input to verify. So, there are things that we should make it clearer: (which I think currently not work)This
Verify()
will not works as if its input is the whole file after signed becausefile.tx
is already changed and different from thesignBytes
. AFAIK we should have samemessage hash
for sign and verify (?)Since it is an oneway function, and the additional information which is added into the
tx.GetSignBytes()
comes from command, how to reconstruct the originalsignBytes
to verify?If we not need to / can not recontruct the orignal
signBytes
, then should we expose thesignedMessage
?Where can user take the hex format to feed the
Verify
command. And since theSign()
writes with signature (JSON encoded) into thefile.tx
, can we remove this argument?WIP:
I am currently working around this and something relates. I am really looking to hearing from all of you.
The text was updated successfully, but these errors were encountered: