aes

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

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)
	ErrInvalidHexString = fmt.Errorf("ciphertext is not a valid hex string")
	ErrShortData        = fmt.Errorf("data is too short")
)

errors

Functions

func Decrypt

func Decrypt(data, key []byte) ([]byte, error)

Decrypt decrypts data using 256-bit AES-GCM, key must have length 32 or more

func DecryptString

func DecryptString(ciphertext, key string) (string, error)

DecryptString decrypts a hex form ciphertext to the plaintext using 256-bit AES-GCM, key must have length 32 or more

func Encrypt

func Encrypt(data, key []byte) ([]byte, error)

Encrypt encrypts data using 256-bit AES-GCM, key must have length 32 or more

func EncryptString

func EncryptString(plaintext, key string) (string, error)

EncryptString encrypts plaintext to ciphertext (hex form) using 256-bit AES-GCM, key must have length 32 or more

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL