func EncryptLongString(raw string, publicKey []byte) (result string, err error) {
	if len(raw) == 0 || len(publicKey) == 0 {
		return "", parametersError
	}
	public, err := getPublickKey(publicKey)
	if err != nil {
		return
	}
	partLen := public.N.BitLen()/8 - 11
	chunks := split([]byte(raw), partLen)
	buffer := bytes.NewBufferString("")
	for _, chunk := range chunks {
		bytes, _ := rsa.EncryptPKCS1v15(rand.Reader, public, chunk)
		buffer.Write(bytes)
	}
	return systemBase64.RawURLEncoding.EncodeToString(buffer.Bytes()), nil
}
EncryptLongString encrypt long string to base64 string
package rsa
import (
	"bytes"
	"crypto/rand"
	"crypto/rsa"
	"crypto/x509"
	"encoding/asn1"
	systemBase64 "encoding/base64"
	"encoding/pem"
	"errors"
	"io"
	"hidevops.io/hiboot/pkg/utils/crypto"
	"hidevops.io/hiboot/pkg/utils/crypto/base64"
)
var (
	publicKeyError  = errors.New("public key error")
	privateKeyError = errors.New("private key error")
	parametersError = errors.New("parameters error")
)
var defaultPrivateKey = []byte(`
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQDTyDSWdsUUZlym136QZnDgcg6FOmbak3Wkr85pxsoTzta9+ARo
xO8n/rw05ZtFsNGEj4ehFRt4+xU2v9GMFHtudj6GdtOs4rP6YpVbzGQd22K0tkAD
bsxMBHKsHsFcg02uFGSF6qIPnrWJIN0wNEJrNumo+XJ9EsXNggfvnp/t8QIDAQAB
AoGASOSG3ScCDFRzHWXchR0NSuNXBhok3qSUgFuWgyfN0+WEWhxsgBcQbcaqxtYk
jGcgpiy0tQfLzec11QNOv5UpKiqQU0TxYJjkRQW+Jz7J1K1YF4IokyJPVU3Rz/IB
RmtFMySZuP+uQdznoqPG5843pCcwCz5q5Gq89zgsubyMNjECQQDy9tex4dwrYtpU
E2abQ+mcOwaJlBMzvjN4sNqkd/ZpvtAfwwt5HE2qAYdNDFk6hI5i3HYQTtMD1+gq
vgWANegFAkEA3yUR7x8gNoSvULdDqOQmrsCqu59/HcIHGcnyZFXPUmMRAXq51aQE
8oS7dXFDUsUK1tdXxGDWYWX4E513kent/QJACIIaZZFKO363tJAFXNSQ/raWcQTt
czdq6AQRdAb7axKSiTo0UaZrFdP93/XZvhHcRpv/ymxoOU87QxvqZ2X73QJBAKbQ
jpylNy6qeGkt5729eZGQZNJIRP4ZC7fiuXr6jzd26cKiXYRxzmUChyUf3AVnWlgL
uggLoJhFY3Q+dqG1MH0CQFppAzwYv0NMmG9eFT2XNrMK7HDAAfPQU+hqd0M3Np7n
J6C0U/ErlLWE8GqXZP7+rPLGYacyUDJiZZMDB2X4AP0=
-----END RSA PRIVATE KEY-----
`)
var defaultPublicKey = []byte(`
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDTyDSWdsUUZlym136QZnDgcg6F
Ombak3Wkr85pxsoTzta9+ARoxO8n/rw05ZtFsNGEj4ehFRt4+xU2v9GMFHtudj6G
dtOs4rP6YpVbzGQd22K0tkADbsxMBHKsHsFcg02uFGSF6qIPnrWJIN0wNEJrNumo
+XJ9EsXNggfvnp/t8QIDAQAB
-----END PUBLIC KEY-----
`)
func Encrypt(input []byte, publicKey ...[]byte) ([]byte, error) {
	actualPublicKey := defaultPublicKey
	if len(publicKey) == 1 && len(publicKey[0]) != 0 {
		actualPublicKey = publicKey[0]
	}
	block, _ := pem.Decode(actualPublicKey)
	if block == nil {
		return nil, crypto.ErrInvalidPublicKey
	}
	pubInterface, err := x509.ParsePKIXPublicKey(block.Bytes)
	if err != nil {
		return nil, err
	}
	pub := pubInterface.(*rsa.PublicKey)
	return rsa.EncryptPKCS1v15(rand.Reader, pub, input)
}
func Decrypt(ciphertext []byte, privateKey ...[]byte) ([]byte, error) {
	actualPrivateKey := defaultPrivateKey
	if len(privateKey) == 1 && len(privateKey[0]) != 0 {
		actualPrivateKey = privateKey[0]
	}
	block, _ := pem.Decode(actualPrivateKey)
	if block == nil {
		return nil, crypto.ErrInvalidPrivateKey
	}
	pk, err := x509.ParsePKCS1PrivateKey(block.Bytes)
	if err != nil {
		return nil, err
	}
	return rsa.DecryptPKCS1v15(rand.Reader, pk, ciphertext)
}
func EncryptBase64(input []byte, publicKey ...[]byte) ([]byte, error) {
	data, err := Encrypt([]byte(input), publicKey...)
	data = base64.Encode(data)
	return data, err
}
func DecryptBase64(input []byte, privateKey ...[]byte) ([]byte, error) {
	ciphertext, err := base64.Decode(input)
	if err == nil {
		data, err := Decrypt(ciphertext, privateKey...)
		return data, err
	}
	return nil, crypto.ErrInvalidInput
}