Documentation ¶
Index ¶
- func DecryptData(ep *Encipherer, typ DecryptType, src string, res any) error
- func EncryptData(ep *Encipherer, typ EncryptType, src any) (string, error)
- type DecryptType
- type Encipherer
- func (e *Encipherer) AesCbcDecrypt(data string) ([]byte, error)
- func (e *Encipherer) AesCbcEncrypt(data []byte) (string, error)
- func (e *Encipherer) GetAesSecretKey() (string, string)
- func (e *Encipherer) RsaPrikeyDecrypt(data string) ([]byte, error)
- func (e *Encipherer) RsaPrikeyEncrypt(data []byte) (string, error)
- func (e *Encipherer) RsaPubkeyDecrypt(data string) ([]byte, error)
- func (e *Encipherer) RsaPubkeyEncrypt(data []byte) (string, error)
- type EncryptType
- type JwtData
- type JwtMiddleware
- type JwtUser
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptData ¶ added in v2.3.0
func DecryptData(ep *Encipherer, typ DecryptType, src string, res any) error
func EncryptData ¶ added in v2.3.0
func EncryptData(ep *Encipherer, typ EncryptType, src any) (string, error)
Types ¶
type DecryptType ¶ added in v2.3.0
type DecryptType int
const ( DecryptTypeAes DecryptType //1-aes解密 DecryptTypeRsaPrikey //2-rsa私钥解密 DecryptTypeRsaPubkey //2-rsa公钥解密 )
type Encipherer ¶
type Encipherer struct {
// contains filtered or unexported fields
}
func NewEncipherer ¶
func NewEncipherer(options ...Option) *Encipherer
func (*Encipherer) AesCbcDecrypt ¶
func (e *Encipherer) AesCbcDecrypt(data string) ([]byte, error)
func (*Encipherer) AesCbcEncrypt ¶
func (e *Encipherer) AesCbcEncrypt(data []byte) (string, error)
func (*Encipherer) GetAesSecretKey ¶
func (e *Encipherer) GetAesSecretKey() (string, string)
func (*Encipherer) RsaPrikeyDecrypt ¶
func (e *Encipherer) RsaPrikeyDecrypt(data string) ([]byte, error)
func (*Encipherer) RsaPrikeyEncrypt ¶
func (e *Encipherer) RsaPrikeyEncrypt(data []byte) (string, error)
func (*Encipherer) RsaPubkeyDecrypt ¶
func (e *Encipherer) RsaPubkeyDecrypt(data string) ([]byte, error)
func (*Encipherer) RsaPubkeyEncrypt ¶
func (e *Encipherer) RsaPubkeyEncrypt(data []byte) (string, error)
type EncryptType ¶ added in v2.3.0
type EncryptType int
const ( EncryptTypeAes EncryptType //1-aes加密 EncryptTypeRsaPrikey //2-rsa私钥加密 EncryptTypeRsaPubkey //2-rsag公钥加密 )
type JwtMiddleware ¶
type JwtMiddleware struct {
// contains filtered or unexported fields
}
func NewJwtMiddleware ¶
func NewJwtMiddleware(user JwtUser) *JwtMiddleware
func (*JwtMiddleware) GetAuthor ¶
func (g *JwtMiddleware) GetAuthor() *jwt.GinJWTMiddleware
func (*JwtMiddleware) IdentityHandler ¶
func (g *JwtMiddleware) IdentityHandler(c *gin.Context) interface{}
func (*JwtMiddleware) PayloadFunc ¶
func (g *JwtMiddleware) PayloadFunc(data interface{}) jwt.MapClaims
type JwtUser ¶
type JwtUser interface { Authenticator(c *gin.Context) (interface{}, error) Unauthorized(c *gin.Context, code int, message string) // User can define own LoginResponse func. LoginResponse(c *gin.Context, code int, message string, time time.Time) // User can define own LogoutResponse func. LogoutResponse(c *gin.Context, code int) // User can define own RefreshResponse func. RefreshResponse(c *gin.Context, code int, message string, time time.Time) }
type Option ¶
type Option func(e *Encipherer)
func WithAesKey ¶
func WithRsaPriKey ¶
func WithRsaPubKey ¶
Click to show internal directories.
Click to hide internal directories.