Simple but handy wrappers around AES crypto methods,
hiding the boilerplate code around crypto/aes
and crypto/cipher
var (
data = []byte("some sencitive data has to be protected with AES")
key = []byte("0123456789ABCDEF")
iv = []byte("qwertyuiodfghjkm")
)
encData, err := aescrypt.EncryptAESCBCPadded(data, key, iv)
if err != nil {
t.Fatal(err)
}
decData, err := aescrypt.DecryptAESCBCPadded(encData, key, iv)
if err != nil {
t.Fatal(err)
}
if !bytes.Equal(data, decData) {
t.Error("decrypted data is not equal to original")
}