sdk icon indicating copy to clipboard operation
sdk copied to clipboard

IC node verify signature and message wrong

Open Explorer0 opened this issue 2 years ago • 1 comments

Help! I'm sorry to come here to make an issue, But the IC repository has banned the issue column. I am developing an ICP wallet, imitating the function of rosseta to construct the transaction, and finally submit the transaction through /construction/submit,but I got some Internet Computer error.(I'm very confused, why my signature can't be verified, I verifyed this signature in golang)

  • error: { "code": 770, "message": "Operation failed", "retriable": false, "details": { "operations": [ { "amount": { "e8s": 100000 }, "fee": { "e8s": 10000 }, "from": "89a472bb2badae8d062e28901c8b6af57ec1352649e4a0f6e755ec4ea56c2d4e", "response": { "code": 740, "details": { "error_message": "Failed to authenticate request 0xe1504898ca77b896bd262859d12a5ddba917a51c6fba6e74a367e9b8fc7b359d due to: Invalid signature: Invalid basic signature: Ed25519 signature could not be verified: public key 214646b3fdff4371282fb9c7dc90ba39d54e953dcc7353f34a9bf7e4ab8e91a9, signature 194e2302013444b4873c0f94c7c4b40d0f46a3709aaf8b51100e83c844953cb485f132e78d5790c2a3ba1b3579beb150974ebe7b371816d7f9d8ba4114738407, error: signature error", "ic_http_status": 403 }, "message": "Internet Computer error", "retriable": false }, "status": "FAILED", "to": "6499d6b24ce488c263cb7aba350249f73d81d6e1caa4fb6fae09d8b3e3f91846", "transaction_identifier": { "hash": "d5e2577ce5c7766375fc9894f0e1622ce0a6478003c10c61fc6f2054466f840a" }, "type": "TRANSACTION" } ] } }

  • golang test code: func Test_VerifySig(t *testing.T) { sigHex := "194e2302013444b4873c0f94c7c4b40d0f46a3709aaf8b51100e83c844953cb485f132e78d5790c2a3ba1b3579beb150974ebe7b371816d7f9d8ba4114738407" hashHex := "e1504898ca77b896bd262859d12a5ddba917a51c6fba6e74a367e9b8fc7b359d" pubKeyHex := "214646b3fdff4371282fb9c7dc90ba39d54e953dcc7353f34a9bf7e4ab8e91a9"

    pubKey := ed25519.PublicKey(common.Hex2Bytes(pubKeyHex)) sig := common.Hex2Bytes(sigHex) hash := common.Hex2Bytes(hashHex)

    assert.Equal(t, ed25519.Verify(pubKey, hash, sig), true, "The signature is wrong!!!" ) }

  • verify result:

截屏2022-03-07 下午8 40 43

Explorer0 avatar Mar 07 '22 12:03 Explorer0

Hi @Explorer0, apologies for not being responsive on this. Is this still an issue or were you able to figure it out?

sesi200 avatar Oct 04 '22 10:10 sesi200