private void lblData2_DoubleClick(object sender, EventArgs e) { if (isdecrypted) { ODD.AESEncrypt(Utilities.D2_KEY, Utilities.D2_IV, d2, 0, d2.Length, d2, 0); } else { ODD.AESDecrypt(Utilities.D2_KEY, Utilities.D2_IV, d2, 0, d2.Length, d2, 0); } lblData2.Text = d2.AsString(); isdecrypted = !isdecrypted; }
// This method will add crap to the D2 data private void PatchD2() { byte[] d2 = new byte[Data2.Length]; ODD.AESDecrypt(Utilities.D2_KEY, Utilities.D2_IV, Data2, 0, Data2.Length, d2, 0); // Fetch the last 4 bytes int val = BitConverter.ToInt32(d2, 12); if (val == 0) { return; } // Fill the last part with a 1, and let the iso builder fill it with crap const int newval = 1; byte[] rnd = BitConverter.GetBytes(newval).Swap(); Array.Copy(rnd, 0, d2, 12, rnd.Length); ODD.AESEncrypt(Utilities.D2_KEY, Utilities.D2_IV, d2, 0, d2.Length, Data2, 0); }
protected override void Crypt(Aes aes, byte[] key, byte[] iv, byte[] source, int sourceOffset, int sourceLength, byte[] dest, int destOffset) { ODD.AESDecrypt(aes, key, iv, source, sourceOffset, sourceLength, dest, destOffset); }