- dingding callback
This commit is contained in:
21
utils/utils_crypt_test.go
Normal file
21
utils/utils_crypt_test.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCrypt(t *testing.T) {
|
||||
aesKey := []byte("123456789012345678901234567890ab")
|
||||
msg := "hellasfsafsdsads"
|
||||
encryptedMsg, err := AESCBCEncpryt([]byte(msg), aesKey, aesKey[:16])
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
decryptedMsg, err := AESCBCDecpryt(encryptedMsg, aesKey, aesKey[:16])
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if msg != string(decryptedMsg) {
|
||||
t.Fatal("result is wrong")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user