I have been using AES for 256 Bit encryption in the .NET framework for quite a few years. I recently started a new project in .NET Core 5 and keep getting and error stating that only 128 bit keys are supported in this installation. After a bit of research it seems that .NET Core only supports 128 bit keys now.
My problem is that I already have mountains of data encrypted with AES using 256 bits. Is there an alternative in .NET Core that I can use? A different library? A different package so that I don't have to decrypt and re-encrypt all of my existing data?
//--------------------------------------------------------------------------
//Perform the encryption
//--------------------------------------------------------------------------
try
{
//Initialize the RijndaelManaged object
rmAES = new RijndaelManaged { BlockSize = 256, Key = key, IV = iv, Padding = PaddingMode.PKCS7 };
//Encrypt the data to the memory stream using the CryptoStream snd StreamWriter
ICryptoTransform rmEncryptor = rmAES.CreateEncryptor(key, iv);
rmMS = new MemoryStream();
using CryptoStream rmCStream = new CryptoStream(rmMS, rmEncryptor, CryptoStreamMode.Write);
using StreamWriter rmSWriter = new StreamWriter(rmCStream);
rmSWriter.Write(sourceString);
rmSWriter.Close();
}
catch (Exception ex)
{
throw new Exception(ex);
}
question from:
https://stackoverflow.com/questions/65851466/256-bit-encryption-in-net-core-5 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…