So after googling for well over 2 hours, I haven't really found any working solution to this problem. I'm trying to encrypt a link but it keeps showing me this one error every time.
Declaration:
if (F != null)
{
text = text.Replace("string license", "string license = @\"" Convert.ToBase64String(F) "\"");
}
Encryption:
{
try
{
Aes aes = new AesManaged
{
Key = new byte[] {},
IV = new byte[16],
Mode = CipherMode.CBC,
Padding = PaddingMode.Zeros
};
ICryptoTransform crypto;
crypto = aes.CreateEncryptor();
return crypto.TransformFinalBlock(message, 0, message.Length); //return encrypted value
}
catch (Exception x)
{
MessageBox.Show(x.Message);
return null;
}
}
Thanks for answers.
CodePudding user response:
I believe your Key needs to be 16 bytes long. new byte[] {} will create a Key that is 0 bytes long