I am trying to convert the logic of Crypt Lib in js I have existing android application and the API is in c sharp and I want to convert encrypt and decrypt logic.
I have tried multiple variations you can check the code: Tried code
I have a sample data which I want to decrypt and the data is:
{"Data":"bvtkHfZiTsY0CX6QmHhCboBwXeY9RZVPpdhhdIy6aSwCTVI7YiEGha1aXTIKY4BocGdNIbWkreQHZcTk4WE6F2tQLoVyWERYCGZotbDzxxs=","IV":"Vmr-uU5mA2_Zr_13"}
Here I have the encrypted data in Data and IV so when I am trying to decrypt this data I can't find any solution. All the encrypt and decrypt function is in csharp and android code. But I want to convert the same logic in golang.
The logic in Node
I have tried this code:
iv := []byte("Vmr-uU5mA2_Zr_13")
key := []byte("<Secret_Key")
text := []byte("bvtkHfZiTsY0CX6QmHhCboBwXeY9RZVPpdhhdIy6aSwCTVI7YiEGha1aXTIKY4BocGdNIbWkreQHZcTk4WE6F2tQLoVyWERYCGZotbDzxxs=")
cipherBlock, err := aes.NewCipher(key)
if err != nil {
log.Fatal(err)
}
cipher.NewCBCDecrypter(cipherBlock, iv).CryptBlocks(text, text)
fmt.Println(string(text))
Full link to the code and I am getting error:
crypto/aes: invalid key size 64