Documentation ¶
Overview ¶
AES CBC PKCS5Padding加/解密
使用 hex.Encode
查看测试文件: aes_cbc_test.go
Index ¶
- func AESDecrypt(decodeStr string, key string) (string, error)
- func AESEncrypt(plainText string, key string) string
- func AesDecryptECB(encrypted []byte, key []byte) (decrypted []byte)
- func AppletDecrypt(sessionKey, encryptedData string, iv string) ([]byte, error)
- func Decrypt(data []byte, key []byte) []byte
- func Encrypt(data []byte, key []byte) []byte
- func FileExist(file string) error
- func GetUUID() (string, error)
- func GobDecode(data []byte, to interface{}) error
- func GobEncode(data interface{}) ([]byte, error)
- func HttpGet(url string) (ret string, err error)
- func HttpPost(url string, param req.Param) (ret string, err error)
- func IntDateTime(val int64) (ret string)
- func IntDateTimeFormat(val int64, format string) (ret string)
- func MD5(str string) string
- func PKCS5Padding(cipherText []byte, blockSize int, after int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func PKCS7UnPadding(plantText []byte) []byte
- func TimeFormat(t time.Time, format string) string
- type MemoryCache
- type XXTea
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesDecryptECB ¶ added in v0.6.8
AES-256-ECB
func AppletDecrypt ¶ added in v0.6.8
微信小程序/头条小程序
解密小程序敏感信息: 对称解密使用的算法为 AES-128-CBC,数据采用PKCS#7填充。 对称解密的目标密文为 Base64_Decode(encryptedData)。 对称解密秘钥 aeskey = Base64_Decode(session_key), aeskey 是16字节。 对称解密算法初始向量 为Base64_Decode(iv),其中iv由数据接口返回。
func Decrypt ¶
Decrypt the data with key. data is the bytes to be decrypted. key is the decrypted key. It is the same as the encrypt key.
func Encrypt ¶
Encrypt the data with key. data is the bytes to be encrypted. key is the encrypt key. It is the same as the decrypt key.
func IntDateTimeFormat ¶
IntDateTimeFormat DateTimeFormat
func PKCS5Padding ¶
PKCS5Padding PKCS5Padding
func PKCS7UnPadding ¶ added in v0.6.8
PKCS7UnPadding return unpadding []Byte plantText
Types ¶
type MemoryCache ¶ added in v0.2.2
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache memory cache struct
func NewMemoryCache ¶ added in v0.2.2
func NewMemoryCache(defaultHour, cleanupInterval int) *MemoryCache
NewMemoryCache return a new memory cache
func (*MemoryCache) GetCache ¶ added in v0.2.2
func (m *MemoryCache) GetCache(key string, to interface{}) (ok bool, err error)
GetCache return cache data
func (*MemoryCache) RemoveCache ¶ added in v0.2.2
func (m *MemoryCache) RemoveCache(key string) error
RemoveCache delete cache
func (*MemoryCache) SetCache ¶ added in v0.2.2
func (m *MemoryCache) SetCache(key string, value interface{}) error
SetCache set cache to key and return error
type XXTea ¶
type XXTea struct {
Key string
}
func (*XXTea) DecryptString ¶
DecryptString DecryptString
func (*XXTea) EncryptString ¶
EncryptString EncryptString