rsa.go
func (rs *RSASigner) VerifyBytes(buf, sig []byte) error {
	var err error

	// check rs.pub
	if rs.pub == nil {
		return ErrMissingPublicKey
	}

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

	// verify
	err = rs.method.Verify(rs.pub, rs.hash, h.Sum(nil), sig)
	if err != nil {
		return ErrInvalidSignature
	}

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

	// check rs.pub
	if rs.pub == nil {
		return ErrMissingPublicKey
	}

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

	// verify
	err = rs.method.Verify(rs.pub, rs.hash, h.Sum(nil), sig)
	if err != nil {
		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.