添加抖音用户信息解密
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -19,3 +20,32 @@ func TestCrypt(t *testing.T) {
|
||||
t.Fatal("result is wrong")
|
||||
}
|
||||
}
|
||||
|
||||
func TestCrypt2(t *testing.T) {
|
||||
//aesKey := []byte("123456789012345678901234567890ab")
|
||||
//msg := "hellasfsafsdsads"
|
||||
//encryptedMsg, err := AESCBCEncpryt([]byte(msg), aesKey, aesKey[:16])
|
||||
//if err != nil {
|
||||
// t.Fatal(err)
|
||||
//}
|
||||
encryptedMsg := "f6T3xoXOusWl0CPnNbJdl/5nYbiNDADGhiUdaLtZoU8sb5iKUifnr89PvQRMVIwtjOeJHpXc0kDRrw+z4zrNlOH2N/LcAjg0WOKT19B1s+LBypnfY24zXgaTEOxzPhqooZMDgIM8KvSqoV+iwFtgo7+PBnry7j/GzFSg91CNTWK6JKB6yk+dqg04SrN+Tw/X/Lmhh6fshWkVKTuZovxp/g=="
|
||||
sessionKey := "nClNe9ciHfYQZIa5CWtnkg=="
|
||||
Base64_DecodeIv := "okoPcc0wFtQUn4E8+ksWZA=="
|
||||
|
||||
bytesPassMsg, _ := base64.StdEncoding.DecodeString(encryptedMsg)
|
||||
Base64_DecodeIv1, _ := base64.StdEncoding.DecodeString(Base64_DecodeIv)
|
||||
sessionKey1, _ := base64.StdEncoding.DecodeString(sessionKey)
|
||||
|
||||
decryptedMsg, err := AESCBC16Decrypt(sessionKey1, Base64_DecodeIv1, bytesPassMsg)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Fatal(string(decryptedMsg))
|
||||
|
||||
//data, err := AESCBCDecpryt(bytesPass, []byte(sessionKey), []byte(Base64_Decode))
|
||||
//if err != nil {
|
||||
// t.Fatal(err)
|
||||
//}
|
||||
//t.Fatal(data)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user