Getting SlowAES and RijndaelManaged class in .NET to play together

maybe I can help. I took your C# code and modified it slightly. The C# code I use, in its entirety, is: using System; using System.Security.Cryptography; public class Bob { internal static string FormatByteArray(byte[] b) { System.Text.StringBuilder sb1 = new System.Text.StringBuilder(); int i = 0; for (i = 0; i < b.Length; i++) { if … Read more

Specified key is not a valid size for this algorithm

The string “ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678912” when base64-decoded yields 48 bytes (384 bits). RijndaelManaged supports 128, 192 and 256 bit keys. A valid 128-bit key is new byte[]{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F } or if you need to get it from base64 : Convert.FromBase64String(“AAECAwQFBgcICQoLDA0ODw==”). The default … Read more

Using AES encryption in C#

If you just want to use the built-in crypto provider RijndaelManaged, check out the following help article (it also has a simple code sample): http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx And just in case you need the sample in a hurry, here it is in all its plagiarized glory: using System; using System.IO; using System.Security.Cryptography; namespace RijndaelManaged_Example { class RijndaelExample … Read more