您的第二次尝试更近了,但是您没有首先解码base64字符串。
如果按照密码包中的
CBCDecrypter示例进行操作,则将具有以下内容:
encKey := "NFd6N3v1nbL47FK0xpZjxZ7NY4fYpNYd"iv := "TestingIV1234567"ciphertext, err := base64.StdEncoding.DepreString("w2f0vBP2hRfgVqssqOluk68Qxkc9LXFESc0ZGzPBq3p6f/x/LbwBbg1XOoRr7I/DAtESJGdweKG6nL9m8RfewA==")if err != nil { panic(err)}block, err := aes.NewCipher([]byte(encKey))if err != nil { panic(err)}if len(ciphertext)%aes.BlockSize != 0 { panic("ciphertext is not a multiple of the block size")}mode := cipher.NewCBCDecrypter(block, []byte(iv))mode.CryptBlocks(ciphertext, ciphertext)fmt.Printf("%sn", ciphertext)https://play.golang.org/p/16wV2UJ5Iw



