Documentation
¶
Index ¶
- Constants
- Variables
- func Decrypt(data, key []byte) ([]byte, error)
- func DecryptBase64String(ciphertext, key string) (string, 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)
Constants ¶
View Source
const KeyLength = 32
KeyLength is the min length of the secret key
Variables ¶
View Source
var (
ErrShortKey = fmt.Errorf("key is too short, %d bytes is required", KeyLength)
)
error
Functions ¶
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 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
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.