View Single Post
Old 19th January 2007, 07:27   #945  |  Link
NghtShd
Registered User
 
Join Date: Dec 2006
Posts: 27
C# port of HDDVDBackup

Please read the following before downloading.

HDDVDBackupG is C# port of HDDVDBackup with a GUI interface.

I'm pretty sure title key decription works properly. It may not work on EVO files however. Since I don't have encrytped EVO files and a corresponding VTKF000.AACS to test with I couldn't do much more than guess at the crypto setup. If you feel it would be a waste of your time if the app fails to decrypt your files then don't bother.

The C# source code will be released, but I'd like to get some feedback regarding EVO decription while I do some code clean up and maybe add a bit more error control. I'll also look at more informative output a progress bar and multithreading if I have time.

http://users.adelphia.net/~m.crane/bin/HDDVDBackup.rar

Below is the main decryption setup. If any crytpo people see any obvious errors please let me know.

Code:
	class AESFunc
	{
		static byte[] AESCBCConstantIV = { 0x0B, 0xA0, 0xF8, 0xDD, 0xFE, 0xA6, 0x1F, 0xB3, 0xD8, 0xDF, 0x9F, 0x56, 0x6A, 0x05, 0x0F, 0x78 };

		public static byte[] AESG(byte[] x1, byte[] x2)
		{

			RijndaelManaged AES = new RijndaelManaged();
			AES.Mode = CipherMode.ECB;
			AES.Padding = PaddingMode.None;
			AES.KeySize = 128;
			//AES.BlockSize = 128;
			ICryptoTransform decryptor = AES.CreateDecryptor(x1, x1);
			MemoryStream memoryStream = new MemoryStream(x2);
			CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read);

			byte[] plainTextBytes = new byte[x2.Length];

			// Start decrypting.
			int decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);

            return Utils.xor(plainTextBytes, x2);
		}

		public static byte[] decryptPack(byte[] pack, byte[] contentKey)
		{
			RijndaelManaged AES = new RijndaelManaged();
			AES.Mode = CipherMode.CBC;
			AES.Padding = PaddingMode.None;
			AES.KeySize = 128;
			//AES.BlockSize = 128;
			ICryptoTransform decryptor = AES.CreateDecryptor(contentKey, AESCBCConstantIV);
			MemoryStream memoryStream = new MemoryStream(pack);
			CryptoStream cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read);

			byte[] plainTextBytes = new byte[pack.Length];

            // Start decrypting.
            int decryptedByteCount = cryptoStream.Read(pack, 0, plainTextBytes.Length);

			return pack;
		}
	}

Last edited by NghtShd; 22nd January 2007 at 02:51. Reason: fixed code: int decryptedByteCount = cryptoStream.Read(pack, 0, plainTextBytes.Length);
NghtShd is offline   Reply With Quote