Reputation: 61646
My .NET Core app is having to read files generated by an older application written in .NET Framework 4.6.x. This older application encrypts files using the System.Security.Cryptography.RijndaelManaged implementation. It uses RijndaelManaged.BlockSize = 256.
Turns out .NET Core only supports .BlockSize = 128. Unfortunately, I have no control over the older application (plus there are already a bunch of files that have been generated).
Is there anyway for a .NET Core app to read RijndaelManaged.BlockSize = 256
encrypted files?
Looking at the old application's code, it looks like it's been adapted from here.
Upvotes: 1
Views: 1113
Reputation: 94058
Yes, you can include the software only Bouncy Castle libraries for .NET (in C#) into your project. This offers a RijndaelEngine
where you can set the block size in the constructor. To implement CBC and padding you also need the CBCBlockCipher
from modes and the right padding, see here for an example (just replace the engine and perform other changes to make it fit your use case).
Upvotes: 1