mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-12 01:10:36 +00:00
core: fix key recovery interops return value
It's uncompressed coordinate, both X and Y, not just X. Fix #1043.
This commit is contained in:
parent
a6541c4514
commit
7d786fac79
2 changed files with 3 additions and 3 deletions
|
@ -626,7 +626,7 @@ func (ic *interopContext) eccRecover(curve elliptic.Curve, v *vm.VM) error {
|
||||||
v.Estack().PushVal([]byte{})
|
v.Estack().PushVal([]byte{})
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
v.Estack().PushVal(pKey.Bytes()[1:])
|
v.Estack().PushVal(pKey.UncompressedBytes()[1:])
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -474,7 +474,7 @@ func TestSecp256k1Recover(t *testing.T) {
|
||||||
X: privateKey.PubKey().X,
|
X: privateKey.PubKey().X,
|
||||||
Y: privateKey.PubKey().Y,
|
Y: privateKey.PubKey().Y,
|
||||||
}
|
}
|
||||||
expected := pubKey.Bytes()[1:]
|
expected := pubKey.UncompressedBytes()[1:]
|
||||||
|
|
||||||
// We don't know which of two recovered keys suites, so let's try both.
|
// We don't know which of two recovered keys suites, so let's try both.
|
||||||
putOnStackGetResult := func(isEven bool) []byte {
|
putOnStackGetResult := func(isEven bool) []byte {
|
||||||
|
@ -505,7 +505,7 @@ func TestSecp256r1Recover(t *testing.T) {
|
||||||
messageHash := hash.Sha256(message).BytesBE()
|
messageHash := hash.Sha256(message).BytesBE()
|
||||||
signature := privateKey.Sign(message)
|
signature := privateKey.Sign(message)
|
||||||
require.True(t, privateKey.PublicKey().Verify(signature, messageHash))
|
require.True(t, privateKey.PublicKey().Verify(signature, messageHash))
|
||||||
expected := privateKey.PublicKey().Bytes()[1:]
|
expected := privateKey.PublicKey().UncompressedBytes()[1:]
|
||||||
|
|
||||||
// We don't know which of two recovered keys suites, so let's try both.
|
// We don't know which of two recovered keys suites, so let's try both.
|
||||||
putOnStackGetResult := func(isEven bool) []byte {
|
putOnStackGetResult := func(isEven bool) []byte {
|
||||||
|
|
Loading…
Reference in a new issue