简体   繁体   中英

How to read RijndaelManaged 256 encrypted files in .NET Core?

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 .

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM