Documentation ¶
Index ¶
- func AESByteDecrypt(cipherByte []byte, key string) ([]byte, error)
- func AESByteEncrypt(data []byte, key string) ([]byte, error)
- func AESDecrypt(cipherText string, key string) ([]byte, error)
- func AESEncrypt(data []byte, key string) (string, error)
- func ComparePasswordHash(password, hash string) bool
- func CryptoJSDecrypt(cipher []byte, key string) ([]byte, error)
- func CryptoJSEncrypt(data []byte, key string) ([]byte, error)
- func DecodeJWTAccessToken(tokenString string, claims jwt.Claims, signKey *rsa.PrivateKey) (jwt.Claims, error)
- func DecryptToken(tokenString string, key *rsa.PrivateKey) ([]byte, error)
- func DecryptTokenWithVerifySign(tokenString string, key *rsa.PrivateKey) ([]byte, error)
- func EncodeJWTAccessToken(claims jwt.Claims, signKey *rsa.PrivateKey) (string, error)
- func EncryptToken(data []byte, key *rsa.PrivateKey) (string, error)
- func EncryptTokenWithSign(data []byte, key *rsa.PrivateKey) (string, error)
- func GenSecretString(n int) string
- func GenSecretStringWithCustomRune(n int, r []rune) string
- func HashPassword(password string) (string, error)
- func HashPasswordWithCost(password string, cost int) (string, error)
- func InitRSAKey(keySize int) (*rsa.PrivateKey, error)
- func RSADecrypt(key *rsa.PrivateKey, cipherText []byte) ([]byte, error)
- func RSAEncrypt(key *rsa.PrivateKey, data []byte) ([]byte, error)
- func RSAPrivateKeyToPEM(key *rsa.PrivateKey) string
- func RSAPublicKeyToPEM(key *rsa.PublicKey) string
- func ReadRSAPrivateKeyFromPEM(keyBytes []byte, password []byte) (*rsa.PrivateKey, error)
- func ReadRSAPublicKeyFromPEM(keyBytes []byte, password []byte) (*rsa.PublicKey, error)
- func SignByRSAKey(key *rsa.PrivateKey, data []byte) ([]byte, error)
- func ValidateString(p string, v []func(rune) bool) bool
- func VerifySignedByRSAKey(key rsa.PublicKey, data []byte, signature []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESByteDecrypt ¶ added in v2.0.10
func ComparePasswordHash ¶
func DecodeJWTAccessToken ¶
func DecodeJWTAccessToken(tokenString string, claims jwt.Claims, signKey *rsa.PrivateKey) (jwt.Claims, error)
func DecryptToken ¶
func DecryptToken(tokenString string, key *rsa.PrivateKey) ([]byte, error)
func DecryptTokenWithVerifySign ¶ added in v2.0.10
func DecryptTokenWithVerifySign(tokenString string, key *rsa.PrivateKey) ([]byte, error)
func EncodeJWTAccessToken ¶
func EncodeJWTAccessToken(claims jwt.Claims, signKey *rsa.PrivateKey) (string, error)
func EncryptToken ¶
func EncryptToken(data []byte, key *rsa.PrivateKey) (string, error)
func EncryptTokenWithSign ¶ added in v2.0.10
func EncryptTokenWithSign(data []byte, key *rsa.PrivateKey) (string, error)
func GenSecretString ¶
func HashPassword ¶
func HashPasswordWithCost ¶ added in v2.0.9
func InitRSAKey ¶
func InitRSAKey(keySize int) (*rsa.PrivateKey, error)
func RSADecrypt ¶
func RSADecrypt(key *rsa.PrivateKey, cipherText []byte) ([]byte, error)
func RSAEncrypt ¶
func RSAEncrypt(key *rsa.PrivateKey, data []byte) ([]byte, error)
func RSAPrivateKeyToPEM ¶
func RSAPrivateKeyToPEM(key *rsa.PrivateKey) string
func RSAPublicKeyToPEM ¶
func ReadRSAPrivateKeyFromPEM ¶
func ReadRSAPrivateKeyFromPEM(keyBytes []byte, password []byte) (*rsa.PrivateKey, error)
func ReadRSAPublicKeyFromPEM ¶
func SignByRSAKey ¶
func SignByRSAKey(key *rsa.PrivateKey, data []byte) ([]byte, error)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.