func (m *SigningMethodRSA) Sign(data []byte, key interface{}) (Signature, error) {
	rsaKey, ok := key.(*rsa.PrivateKey)
	if !ok {
		return nil, ErrInvalidKey
	}
	sigBytes, err := rsa.SignPKCS1v15(rand.Reader, rsaKey, m.Hash, m.sum(data))
	if err != nil {
		return nil, err
	}
	return Signature(sigBytes), nil
}
Sign implements the Sign method from SigningMethod.
For this signing method, must be an *rsa.PrivateKey structure.
package crypto
import (
	"crypto"
	"crypto/rand"
	"crypto/rsa"
	"encoding/json"
)
type SigningMethodRSA struct {
	Name string
	Hash crypto.Hash
	_    struct{}
}
var (
	SigningMethodRS256 = &SigningMethodRSA{
		Name: "RS256",
		Hash: crypto.SHA256,
	}
	SigningMethodRS384 = &SigningMethodRSA{
		Name: "RS384",
		Hash: crypto.SHA384,
	}
	SigningMethodRS512 = &SigningMethodRSA{
		Name: "RS512",
		Hash: crypto.SHA512,
	}
)
func (m *SigningMethodRSA) Alg() string { return m.Name }
func (m *SigningMethodRSA) Verify(raw []byte, sig Signature, key interface{}) error {
	rsaKey, ok := key.(*rsa.PublicKey)
	if !ok {
		return ErrInvalidKey
	}
	return rsa.VerifyPKCS1v15(rsaKey, m.Hash, m.sum(raw), sig)
}