Aes Encrypt and Decrypt null adds bytes

QuestionsCategory: QuestionsAes Encrypt and Decrypt null adds bytes
Brightn-n-Fresh Staff asked 1 year ago

Hi there i'm using this encryption method to encrypt my json value in .net side

public static string Encrypt256(string text)
        AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
        aes.BlockSize = 128;
        aes.KeySize = 256;
        aes.IV = Encoding.UTF8.GetBytes(AesIV256);
        aes.Key = Encoding.UTF8.GetBytes(AesKey256);
        aes.Mode = CipherMode.CBC;

        byte[] src = Encoding.Unicode.GetBytes(text);

        using (ICryptoTransform encrypt = aes.CreateEncryptor())
            byte[] dest = encrypt.TransformFinalBlock(src, 0, src.Length);
            return Convert.ToBase64String(dest);

And im trying to decrypt it in Node Js side and as you can see on the pic there are null bytes after every letter any idea why this is happening?