Documentation ¶
Index ¶
- type AESHandler
- func (h *AESHandler) Cipher(handler CipherHandler) *AESHandler
- func (h *AESHandler) Decrypt(ciphertext []byte) (plaintext []byte, err error)
- func (h *AESHandler) DecryptString(rawCipher string) ([]byte, error)
- func (h *AESHandler) Encrypt(plaintext []byte) (ciphertext []byte, err error)
- func (h *AESHandler) EncryptString(plaintext []byte) (string, error)
- func (h *AESHandler) GetIv() []byte
- func (h *AESHandler) MustEncryptString(plaintext []byte) string
- func (h *AESHandler) PKCS7Padding(src []byte, blockSize int) ([]byte, error)
- func (h *AESHandler) PKCS7UnPadding(src []byte) ([]byte, error)
- type CipherHandler
- type Md5
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AESHandler ¶
type AESHandler struct {
CipherHandler
}
AESHandler AES CBC 加密模式
func (*AESHandler) Cipher ¶
func (h *AESHandler) Cipher(handler CipherHandler) *AESHandler
Cipher AES密钥
func (*AESHandler) Decrypt ¶
func (h *AESHandler) Decrypt(ciphertext []byte) (plaintext []byte, err error)
Decrypt 使用AES-CBC解密数据,根据密钥长度选择AES-128, AES-192, 或 AES-256
func (*AESHandler) DecryptString ¶
func (h *AESHandler) DecryptString(rawCipher string) ([]byte, error)
DecryptString 解密原始密文并逆解析转义密文
func (*AESHandler) Encrypt ¶
func (h *AESHandler) Encrypt(plaintext []byte) (ciphertext []byte, err error)
Encrypt 使用AES-CBC加密数据,根据密钥长度选择AES-128, AES-192, 或 AES-256
func (*AESHandler) EncryptString ¶
func (h *AESHandler) EncryptString(plaintext []byte) (string, error)
EncryptString 使用AES-CBC加密数据,根据密钥长度选择AES-128, AES-192, 或 AES-256, 转换为十六进制或base64
func (*AESHandler) MustEncryptString ¶
func (h *AESHandler) MustEncryptString(plaintext []byte) string
MustEncryptString 必须加密字符串 使用AES-CBC加密数据,根据密钥长度选择AES-128, AES-192, 或 AES-256, 转换为十六进制或base64
func (*AESHandler) PKCS7Padding ¶
func (h *AESHandler) PKCS7Padding(src []byte, blockSize int) ([]byte, error)
PKCS7Padding 实现了PKCS#7的填充方式
func (*AESHandler) PKCS7UnPadding ¶
func (h *AESHandler) PKCS7UnPadding(src []byte) ([]byte, error)
PKCS7UnPadding 实现了PKCS#7的去填充方式
type CipherHandler ¶
CipherHandler AES密钥
type Md5 ¶
type Md5 struct {
// contains filtered or unexported fields
}
func (Md5) EncryptString ¶
EncryptString 使用Md5加密
func (Md5) MustEncryptString ¶
MustEncryptString 使用Md5加密
Click to show internal directories.
Click to hide internal directories.