// Copyright 2019 github.com. All rights reserved. // Use of this source code is governed by github.com. package util import ( "encoding/base64" "testing" ) func Test_AesEncryt(t *testing.T) { if data, err := AesEncrypt("abc", "08d77a89db24d8a6271f488462b500ce"); err == nil { baseData := base64.StdEncoding.EncodeToString(data) t.Log(baseData) } else { t.Error(err) } } func Test_AesDecryt(t *testing.T) { if src, err := base64.StdEncoding.DecodeString("RDlKksejWobcc/2V8XBVHQ=="); err == nil { if data, err := AesDecrypt(src, []byte("08d77a89db24d8a6271f488462b500ce")); err == nil { t.Log(string(data)) if string(data) != "abc" { t.Errorf("AesDecrypt failed. data:%s", string(data)) } } else { t.Error(err) } } else { t.Error(err) } }