Documentation
¶
Index ¶
- Constants
- Variables
- func Decrypt(data, key []byte) ([]byte, error)
- func DecryptBase64(ciphertext, key string) ([]byte, error)
- func DecryptBase64String(ciphertext, key string) (string, error)
- func DecryptHex(ciphertext, key string) ([]byte, error)
- func DecryptHexString(ciphertext, key string) (string, error)
- func Encrypt(data, key []byte) ([]byte, error)
- func EncryptStringToBase64(plaintext, key string) (string, error)
- func EncryptStringToHex(plaintext, key string) (string, error)
- func EncryptToBase64(data []byte, key string) (string, error)
- func EncryptToHex(data []byte, key string) (string, error)
Constants ¶
const KeyLength = 32
KeyLength is the min length of the secret key
Variables ¶
var ( // ErrShortKey key is too short ErrShortKey = fmt.Errorf("key is too short, %d bytes is required", KeyLength) )
Functions ¶
func DecryptBase64 ¶ added in v0.3.1
DecryptBase64 decrypts a base64 form ciphertext to raw data([]byte) using 256-bit AES-GCM, key must have length 32 or more
func DecryptBase64String ¶ added in v0.2.0
DecryptBase64String decrypts a base64 form ciphertext to the plaintext using 256-bit AES-GCM, key must have length 32 or more
func DecryptHex ¶ added in v0.3.1
DecryptHex decrypts a hex form ciphertext to raw data([]byte) using 256-bit AES-GCM, key must have length 32 or more
func DecryptHexString ¶ added in v0.2.0
DecryptHexString decrypts a hex form ciphertext to the plaintext using 256-bit AES-GCM, key must have length 32 or more
func EncryptStringToBase64 ¶ added in v0.2.0
EncryptStringToBase64 encrypts plaintext to ciphertext (base64 form) using 256-bit AES-GCM, key must have length 32 or more
func EncryptStringToHex ¶ added in v0.2.0
EncryptStringToHex encrypts plaintext to ciphertext (hex form) using 256-bit AES-GCM, key must have length 32 or more
func EncryptToBase64 ¶ added in v0.3.1
EncryptToBase64 encrypts data to ciphertext (base64 form) using 256-bit AES-GCM, key must have length 32 or more
Types ¶
This section is empty.