protected CryptoRegion(UInt32 region, byte[] d1, byte[] d2, UInt32 StartSector, UInt32 Next) : base(region) { byte[] user_key_erk = { 0x38, 0x0B, 0xCF, 0x0B, 0x53, 0x45, 0x5B, 0x3C, 0x78, 0x17, 0xAB, 0x4F, 0xA3, 0xBA, 0x90, 0xED }; byte[] user_key_riv = { 0x69, 0x47, 0x47, 0x72, 0xAF, 0x6F, 0xDA, 0xB3, 0x42, 0x74, 0x3A, 0xEF, 0xAA, 0x18, 0x62, 0x87 }; Start = StartSector + 1; Length = Next - Start; DiskKey = new byte[0x10]; ODD.AESEncrypt(user_key_erk, user_key_riv, d1, 0, 0x10, DiskKey, 0); }
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.AESEncrypt(key, iv, source, sourceOffset, sourceLength, dest, destOffset); }