Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AESEncrypt ¶
type AESEncrypt struct {
Key []byte // 加密密钥
Model AESModel // 加密模式
IVCreator IVCreator // IV规则 不指定时使用默认方式
ResultCreator ResultCreator // 最终结果返回规则 不指定则使用默认方式
PaddingCreator PaddingCreator // 填充规则
// contains filtered or unexported fields
}
AESEncrypt AES加密实现
func NewAESWithOption ¶
func NewAESWithOption(key []byte, option AESOption) *AESEncrypt
NewAESWithOption 创建AES加密实现
func (*AESEncrypt) DecryptBase64 ¶
func (a *AESEncrypt) DecryptBase64(base64CipherData string) (string, error)
func (*AESEncrypt) EncryptBase64 ¶
func (a *AESEncrypt) EncryptBase64(base64RawData string) (string, error)
type AESOption ¶
type AESOption struct {
IVCreator IVCreator // IV规则 不指定时使用默认方式
Model AESModel // 加密模式
ResultCreator ResultCreator // 最终结果返回规则 不指定则使用默认方式
PaddingCreator PaddingCreator // 填充规则
}
type CryptEncrypt ¶
type CryptEncrypt interface {
// Encrypt 加密
Encrypt(rawData []byte) ([]byte, error)
// EncryptBase64 加密
EncryptBase64(base64RawData string) (string, error)
// Decrypt 解密
Decrypt(cipherData []byte) ([]byte, error)
// DecryptBase64 解密
DecryptBase64(base64CipherData string) (string, error)
}
CryptEncrypt 对称加密通用接口
type IVCreator ¶
type IVCreator interface {
// Encrypt 加密时创建IV
Encrypt(key, paddedRawData []byte) [aes.BlockSize]byte
// Decrypt 解密时创建IV
Decrypt(key, cipherText []byte) [aes.BlockSize]byte
}
IVCreator IV自定义创建接口
Click to show internal directories.
Click to hide internal directories.