crypto

package
v2.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESByteDecrypt added in v2.0.10

func AESByteDecrypt(cipherByte []byte, key string) ([]byte, error)

func AESByteEncrypt added in v2.0.10

func AESByteEncrypt(data []byte, key string) ([]byte, error)

func AESDecrypt

func AESDecrypt(cipherText string, key string) ([]byte, error)

func AESEncrypt

func AESEncrypt(data []byte, key string) (string, error)

func ComparePasswordHash

func ComparePasswordHash(password, hash string) bool

func CryptoJSDecrypt

func CryptoJSDecrypt(cipher []byte, key string) ([]byte, error)

func CryptoJSEncrypt

func CryptoJSEncrypt(data []byte, key string) ([]byte, error)

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 GenSecretString(n int) string

func GenSecretStringWithCustomRune

func GenSecretStringWithCustomRune(n int, r []rune) string

func HashPassword

func HashPassword(password string) (string, error)

func HashPasswordWithCost added in v2.0.9

func HashPasswordWithCost(password string, cost int) (string, error)

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 RSAPublicKeyToPEM(key *rsa.PublicKey) string

func ReadRSAPrivateKeyFromPEM

func ReadRSAPrivateKeyFromPEM(keyBytes []byte, password []byte) (*rsa.PrivateKey, error)

func ReadRSAPublicKeyFromPEM

func ReadRSAPublicKeyFromPEM(keyBytes []byte, password []byte) (*rsa.PublicKey, error)

func SignByRSAKey

func SignByRSAKey(key *rsa.PrivateKey, data []byte) ([]byte, error)

func ValidateString

func ValidateString(p string, v []func(rune) bool) bool

func VerifySignedByRSAKey

func VerifySignedByRSAKey(key rsa.PublicKey, data []byte, signature []byte) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL