MCPcopy
hub / github.com/inbug-team/InScan / AesDecrypt

Function AesDecrypt

generate_exec/generate_exec.go:92–109  ·  view source on GitHub ↗

AES CBC 解码

(cry string, key string)

Source from the content-addressed store, hash-verified

90
91// AES CBC 解码
92func AesDecrypt(cry string, key string) string {
93 // 转成字节数组
94 cryByte, _ := base64.StdEncoding.DecodeString(cry)
95 k := []byte(key)
96 // 分组秘钥
97 block, _ := aes.NewCipher(k)
98 // 获取秘钥块的长度
99 blockSize := block.BlockSize()
100 // 加密模式
101 blockMode := cipher.NewCBCDecrypter(block, k[:blockSize])
102 // 创建数组
103 orig := make([]byte, len(cryByte))
104 // 解密
105 blockMode.CryptBlocks(orig, cryByte)
106 // 去补全码
107 orig = PKCS7UnPadding(orig)
108 return string(orig)
109}
110
111func AppendExec(data interface{}, tplPath, execPath string) {
112 // 1.读取模板内容

Callers 1

mainFunction · 0.92

Calls 1

PKCS7UnPaddingFunction · 0.85

Tested by

no test coverage detected