func (es *EccSigner) VerifyBytes(buf, sig []byte) error {
	var err error

	// check es.pub
	if es.pub == nil {
		return ErrInvalidPublicKey
	}

	// hash
	h := es.hash.New()
	_, err = h.Write(buf)
	if err != nil {
		return err
	}

	// check decoded length
	if len(sig) != 2*es.keyLen {
		return ErrInvalidSignature
	}

	r := big.NewInt(0).SetBytes(sig[:es.keyLen])
	s := big.NewInt(0).SetBytes(sig[es.keyLen:])

	// verify
	if !ecdsa.Verify(es.pub, h.Sum(nil), r, s) {
		return ErrInvalidSignature
	}

	return nil
}
func (es *EccSigner) VerifyBytes(buf, sig []byte) error {
	var err error

	
	if es.pub == nil {
		return ErrInvalidPublicKey
	}

	
	h := es.hash.New()
	_, err = h.Write(buf)
	if err != nil {
		return err
	}

	
	if len(sig) != 2*es.keyLen {
		return ErrInvalidSignature
	}

	r := big.NewInt(0).SetBytes(sig[:es.keyLen])
	s := big.NewInt(0).SetBytes(sig[es.keyLen:])

	
	if !ecdsa.Verify(es.pub, h.Sum(nil), r, s) {
		return ErrInvalidSignature
	}

	return nil
}
func ( es * EccSigner ) VerifyBytes ( buf , sig [ ] byte ) error { var err error // check es.pub if es . pub == nil { return ErrInvalidPublicKey } // hash h := es . hash . New ( ) _ , err = h . Write ( buf ) if err != nil { return err } // check decoded length if len ( sig ) != 2 * es . keyLen { return ErrInvalidSignature } r := big . NewInt ( 0 ) . SetBytes ( sig [ : es . keyLen ] ) s := big . NewInt ( 0 ) . SetBytes ( sig [ es . keyLen : ] ) // verify if ! ecdsa . Verify ( es . pub , h . Sum ( nil ) , r , s ) { return ErrInvalidSignature } return nil }
// VerifyBytes creates a signature for buf, comparing it against the raw sig.
// If the sig is invalid, then ErrInvalidSignature is returned.
VerifyBytes creates a signature for buf comparing it against the raw sig . If the sig is invalid then ErrInvalidSignature is returned .