func (s *PS256Signer) Sign(msg []byte) ([]byte, error) {
	hasher := crypto.SHA256.New()
	_, _ = hasher.Write(msg)
	hashed := hasher.Sum(nil)
	return rsa.SignPSS(rand.Reader, s.privateKey, crypto.SHA256, hashed, &rsa.PSSOptions{
		SaltLength: rsa.PSSSaltLengthEqualsHash,
	})
}
Sign signs a message.
package signer
import (
	"crypto"
	"crypto/rand"
	"crypto/rsa"
	"crypto/x509"
)
func NewRS256Signer() (*RS256Signer, error) {
	privKey, err := rsa.GenerateKey(rand.Reader, 2048)
	if err != nil {
		return nil, err
	}
	return newRS256Signer(privKey), nil
}
func GetRS256Signer(privKey *rsa.PrivateKey) *RS256Signer {
	return newRS256Signer(privKey)
}
func newRS256Signer(privKey *rsa.PrivateKey) *RS256Signer {
	return &RS256Signer{*newRSASigner(privKey)}
}
type RS256Signer struct {
	rsaSigner
}
func (s *RS256Signer) Sign(msg []byte) ([]byte, error) {
	hasher := crypto.SHA256.New()
	_, _ = hasher.Write(msg)
	hashed := hasher.Sum(nil)
	return rsa.SignPKCS1v15(rand.Reader, s.privateKey, crypto.SHA256, hashed)
}
func NewPS256Signer() (*PS256Signer, error) {
	privKey, err := rsa.GenerateKey(rand.Reader, 2048)
	if err != nil {
		return nil, err
	}
	return newPS256Signer(privKey), nil
}
func GetPS256Signer(privKey *rsa.PrivateKey) *PS256Signer {
	return newPS256Signer(privKey)
}
func newPS256Signer(privKey *rsa.PrivateKey) *PS256Signer {
	return &PS256Signer{*newRSASigner(privKey)}
}
type PS256Signer struct {
	rsaSigner
}