func (party *EcdsaParty) Phase3(r2 *secp256k1.Scalar) *secp256k1.Scalar {
	k := party.k
	curve := party.curve
	rx, ry := curve.ScalarMult(r2.X, r2.Y, k.Bytes())
	return secp256k1.NewScalar(rx, ry)
}
Phase3 -- set party2's r2 to this party.
Return the shared R.
package xcrypto
import (
	"errors"
	"math/big"
	"crypto/elliptic"
	xecdsa "github.com/keyfuse/tokucore/xcrypto/ecdsa"
	"github.com/keyfuse/tokucore/xcrypto/paillier"
	"github.com/keyfuse/tokucore/xcrypto/secp256k1"
)
const (
	bitlen = 2048
)
type EcdsaParty struct {
	k      *big.Int
	kinv   *big.Int
	N      *big.Int
	prv    *PrvKey
	pub    *PubKey
	hash   []byte
	curve  elliptic.Curve
	encpk  *big.Int
	encprv *paillier.PrvKey
}
func NewEcdsaParty(prv *PrvKey) *EcdsaParty {
	pub := prv.PubKey()
	curve := pub.Curve
	N := curve.Params().N
	return &EcdsaParty{
		N:     N,
		prv:   prv,
		pub:   pub,
		curve: curve,
	}
}
func (party *EcdsaParty) Phase1(pub2 *PubKey) *PubKey {
	prv := party.prv
	pub := prv.PubKey()
	curve := pub.Curve
	px, py := curve.ScalarMult(pub2.X, pub2.Y, prv.D.Bytes())
	return &PubKey{X: px, Y: py, Curve: curve}
}
func (party *EcdsaParty) Phase2(hash []byte) (*big.Int, *paillier.PubKey, *secp256k1.Scalar) {
	N := party.N
	prv := party.prv
	pub := prv.PubKey()
	curve := pub.Curve
	party.hash = hash
	encpub, encprv, err := paillier.GenerateKeyPair(bitlen)
	if err != nil {
		return nil, nil, nil
	}
	party.encprv = encprv
	encpk, err := encpub.Encrypt(prv.D)
	if err != nil {
		return nil, nil, nil
	}
	party.encpk = encpk
	k := xecdsa.NonceRFC6979(N, prv.D, hash)
	kinv := new(big.Int).ModInverse(k, N)
	party.k = k
	party.kinv = kinv
	rx, ry := curve.ScalarBaseMult(k.Bytes())
	return encpk, encpub, secp256k1.NewScalar(rx, ry)
}