Documentation ¶
Index ¶
- func GetAesEncrypt(baseString string) (string, error)
- func GetBase64Decode(src []byte) ([]byte, error)
- func GetBase64Encode(src []byte) []byte
- type Crypt
- func (c *Crypt) Decrypt(src []byte) []byte
- func (c *Crypt) DecryptBase64(base64String string) (string, error)
- func (c *Crypt) DecryptStream(reader io.Reader, writer io.Writer) error
- func (c *Crypt) Encrypt(src []byte) []byte
- func (c *Crypt) EncryptBase64(plainText string) string
- func (c *Crypt) EncryptStream(reader io.Reader, writer io.Writer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAesEncrypt ¶
GetAesEncrypt to cipher by Aes
func GetBase64Decode ¶
GetBase64Decode is to decode by base64
func GetBase64Encode ¶
GetBase64Encode is to encode by Base64
Types ¶
type Crypt ¶
type Crypt struct {
// contains filtered or unexported fields
}
Crypt is for cipher config data
func NewCrypt ¶
NewCrypt is to create crypt instance key size should be 16,24,32 iv size should be 16
func NewCryptWithEnv ¶
NewCryptWithEnv is setup with default settings.
func (*Crypt) Decrypt ¶
Decrypt is to decrypt a slice of bytes, producing a new, freshly allocated slice Source will be padded with null bytes if necessary
func (*Crypt) DecryptBase64 ¶
DecryptBase64 is to decrypt decoded Base64 string
func (*Crypt) DecryptStream ¶
DecryptStream is to decrypt blocks from reader, write results into writer
func (*Crypt) Encrypt ¶
Encrypt is encrypt a slice of bytes, producing a new, freshly allocated slice Source will be padded with null bytes if necessary
func (*Crypt) EncryptBase64 ¶
EncryptBase64 is encrypt and encode by base64 string