Closed 0xmountaintop closed 4 years ago
why https://github.com/binance-chain/tss-lib/blob/4fcd04b0ce5527ece51afa70c7852b5fd03b120c/ecdsa/signing/finalize.go#L59
instead of
sig := btcec.Signature{ R: new(big.Int).SetBytes(round.data.R), S: new(big.Int).SetBytes(round.data.S), } round.data.Signature = sig.Serialize()
such serialization also passes the test case in local_party_test.go
local_party_test.go
signature, err := btcec.ParseSignature(sig.Serialize(), btcec.S256()) if err != nil { t.Log("parse secp256k1 signature failed") } if !signature.Verify(big.NewInt(42).Bytes(), pubKey) { t.Log("errVerifyFail") }
pubKey is
pkX, pkY := keys[0].ECDSAPub.X(), keys[0].ECDSAPub.Y() pk := ecdsa.PublicKey{ Curve: tss.EC(), X: pkX, Y: pkY, } pubKey, err := btcec.ParsePubKey((*btcec.PublicKey)(&pk).SerializeCompressed(), btcec.S256()) if err != nil { t.Log("parse secp256k1 public key failed") }
We didn't want to be bound too tightly to btcec in the API.
You can rebuild the btcec.Signature easily:
sig := &btcec.Signature{ R: new(big.Int).SetBytes(data.R), S: new(big.Int).SetBytes(data.S), }
why https://github.com/binance-chain/tss-lib/blob/4fcd04b0ce5527ece51afa70c7852b5fd03b120c/ecdsa/signing/finalize.go#L59
instead of
such serialization also passes the test case in
local_party_test.go
pubKey is