Documentation ¶
Index ¶
- Variables
- func Decrypt(crypted []byte, key []byte) ([]byte, error)
- func DecryptUngzip(src io.Reader, dstPath string, aesKey []byte) error
- func Encrypt(origData []byte, key []byte) ([]byte, error)
- func GzipEncryption(src io.Reader, dstPath string, aesKey []byte) error
- func PKCS5Padding(origData []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func RowDecryptUngzip(d, key []byte) ([]byte, error)
- func RowGzipEncryption(d, key []byte) ([]byte, error)
- type AesDecryptR
- type AesDecryptW
- type AesEncrypt
- type AesEncryptW
Constants ¶
This section is empty.
Variables ¶
var IV []byte = []byte("0123456789876543")
aes 初始化向量
Functions ¶
func Decrypt ¶
@title Decrypt @description aes 解密 @param crypted []byte 密文数据, key []byte aes密钥 @return []byte 明文数据, error
func DecryptUngzip ¶
@title DecryptUngzip @description 将 src 中的数据aes解密gzip解压缩然后写入 dstPath 路径 @param src io.Reader 提供密文数据、 @param dstPath string 解密解压缩后文件路径 @param aesKey []byte aes 密钥 @return error
func Encrypt ¶
@title Encrypt @description aes 加密 @param origData []byte 明文数据, key []byte aes密钥 @return []byte 密文, error
func GzipEncryption ¶
@title GzipEncryption @description 将 src 中的数据gzip压缩然后aes加密写入 dstPath 路径 @param src io.Reader 提供明文数据、 @param dstPath string 压缩加密后文件路径 @param aesKey []byte aes 密钥 @return error
func PKCS5Padding ¶
@title PKCS5Padding @description 填充明文 @param origData []byte 明文数据,blockSize int aes分组长度 @return []byte
func PKCS5UnPadding ¶
@title PKCS5UnPadding @description 去除填充 @param origData []byte 明文数据 @return []byte
func RowDecryptUngzip ¶ added in v0.0.6
对一行数据解密解压缩为
func RowGzipEncryption ¶ added in v0.0.6
对一行数据压缩加密
Types ¶
type AesDecryptR ¶
type AesDecryptR struct {
// contains filtered or unexported fields
}
AesDecryptW 流式解密 io.Write --AES--> []byte
func NewAesDecryptR ¶
func NewAesDecryptR(f io.Reader, aesKey []byte) (*AesDecryptR, error)
@title NewAesDecryptR @description 创建 *AesDecryptW @param f io.Reader 加密后数据写入 f @param aesKey []byte aes密钥 @return *NewAesEncryptW
type AesDecryptW ¶
type AesDecryptW struct {
// contains filtered or unexported fields
}
AesDecryptW 流式解密 []byte --AES--> io.Writer
func NewAesDecryptW ¶
func NewAesDecryptW(f io.WriteCloser, aesKey []byte) (*AesDecryptW, error)
@title NewAesDecryptW @description 创建 *AesDecryptW @param f io.Writer 加密后数据写入 f @param aesKey []byte aes密钥 @return *NewAesEncryptW
type AesEncrypt ¶
type AesEncrypt struct {
// contains filtered or unexported fields
}
AesDecryptR 流式加密 io.Reader --AES--> []byte
func NewAesEncrypt ¶
func NewAesEncrypt(f io.Reader, aesKey []byte) (*AesEncrypt, error)
@title NewAesDecryptR @description 创建 *NewAesDecryptR @param f io.Reader 提供明文数据, aesKey []byte aes密钥 @return *NewAesDecryptR
type AesEncryptW ¶
type AesEncryptW struct {
// contains filtered or unexported fields
}
AesEncryptW 流式加密 []byte --AES--> io.Writer
func NewAesEncryptW ¶
func NewAesEncryptW(f io.WriteCloser, aesKey []byte) (*AesEncryptW, error)
@title NewAesEncryptW @description 创建 *AesEncryptW @param f io.Writer 加密后数据写入 f @param aesKey []byte aes密钥 @return *NewAesEncryptW
func (*AesEncryptW) Flush ¶
func (e *AesEncryptW) Flush() error
Flush flush @description 在最后一轮加密后,使用此函数将buf中不足 roundSize 大小的数据加密