func (d Driver) Validate(msg, pub, sig []byte) error {
	err := crypto.BasicValidation(d, msg, pub, sig)
	if err != nil {
		return err
	}
	if EcdsaAuthor.IsInit {
		err = EcdsaAuthor.Validate(pub, sig)
	}
	return err
}
Validate validate msg and signature
package secp256r1
import (
	"bytes"
	"errors"
	"fmt"
	cert "github.com/33cn/chain33/system/crypto/common"
	"github.com/33cn/chain33/system/crypto/common/authority"
	"github.com/33cn/chain33/system/crypto/common/authority/utils"
	"github.com/golang/protobuf/proto"
	"crypto/ecdsa"
	"crypto/elliptic"
	"crypto/rand"
	"math/big"
	"github.com/33cn/chain33/common/crypto"
)
const (
	privateKeyECDSALength          = 32
	publicKeyECDSALength           = 65
	publicKeyECDSALengthCompressed = 33
)
var EcdsaAuthor = authority.Authority{}
type Driver struct{}
func (d Driver) GenKey() (crypto.PrivKey, error) {
	privKeyBytes := [privateKeyECDSALength]byte{}
	copy(privKeyBytes[:], crypto.CRandBytes(privateKeyECDSALength))
	priv, _ := privKeyFromBytes(elliptic.P256(), privKeyBytes[:])
	copy(privKeyBytes[:], SerializePrivateKey(priv))
	return PrivKeyECDSA(privKeyBytes), nil
}
func (d Driver) PrivKeyFromBytes(b []byte) (privKey crypto.PrivKey, err error) {
	if len(b) != privateKeyECDSALength {
		return nil, errors.New("invalid priv key byte")
	}
	privKeyBytes := new([privateKeyECDSALength]byte)
	copy(privKeyBytes[:], b[:privateKeyECDSALength])
	priv, _ := privKeyFromBytes(elliptic.P256(), privKeyBytes[:])
	copy(privKeyBytes[:], SerializePrivateKey(priv))
	return PrivKeyECDSA(*privKeyBytes), nil
}
func (d Driver) PubKeyFromBytes(b []byte) (pubKey crypto.PubKey, err error) {
	if len(b) != publicKeyECDSALength && len(b) != publicKeyECDSALengthCompressed {
		return nil, errors.New("invalid pub key byte")
	}
	pubKeyBytes := new([publicKeyECDSALengthCompressed]byte)
	copy(pubKeyBytes[:], b[:])
	return PubKeyECDSA(*pubKeyBytes), nil
}
func (d Driver) SignatureFromBytes(b []byte) (sig crypto.Signature, err error) {
	var certSignature cert.CertSignature
	err = proto.Unmarshal(b, &certSignature)
	if err != nil {
		return SignatureECDSA(b), nil
	}
	if len(certSignature.Cert) == 0 {
		return SignatureECDSA(b), nil
	}
	return SignatureECDSA(certSignature.Signature), nil
}