public void parseDRM(byte[] byteData, int drmCount, List <byte[]> pidList) { byte[] keyVec1 = new byte[] { 0x72, 0x38, 0x33, (byte)0xB0, (byte)0xB4, (byte)0xF2, (byte)0xE3, (byte)0xCA, (byte)0xDF, 0x09, 0x01, (byte)0xD6, (byte)0xE2, (byte)0xE0, 0x3F, (byte)0x96 }; foreach (byte[] pid in pidList) { byte[] bigpid = new byte[16]; for (int i = 0; i < 16; i++) { bigpid[i] = 0x00; } for (int i = 0; i < pid.Count(); i++) { bigpid[i] = pid[i]; } byte[] tempKey = PK1Enc(bigpid, keyVec1); int tempKeySum = 0; for (int i = 0; i < tempKey.Count(); i++) { tempKeySum += tempKey[i]; } tempKeySum = tempKeySum & 0xFF; ArraySlice data = new ArraySlice(byteData); for (int i = 0; i < drmCount; i++) { int verification = (int)data.getLong(i * 0x30); int size = (int)data.getLong(i * 0x30 + 4); int type = (int)data.getLong(i * 0x30 + 8); int chkSum = (int)data.getByte(i * 0x30 + 12) & 0xFF; byte[] cookie = data.byteSlice(i * 0x30 + 16, 32); if (chkSum == tempKeySum) { Debug.WriteLine("Cookie: " + bytesToHex(cookie) + " Found at DRMCount: " + i); Debug.WriteLine("Temp Key: " + bytesToHex(tempKey)); cookie = PK1Dec(cookie, tempKey, true); Debug.WriteLine("Decrypted Cookie: " + bytesToHex(cookie) + " Found at DRMCount: " + i); ArraySlice slice = new ArraySlice(cookie); int ver = (int)slice.getLong(); int flags = (int)slice.getLong(); int finalkey = (int)slice.getLong(); if (verification == ver && ((flags & 0x1F) > 0)) { Debug.WriteLine("W00000T"); } } } Debug.WriteLine("PID: " + Encoding.Default.GetString(pid)); Debug.WriteLine("HEX BIGPID: " + bytesToHex(bigpid)); Debug.WriteLine("Key Vec: " + bytesToHex(keyVec1)); Debug.WriteLine("Temp Key: " + bytesToHex(tempKey)); Debug.WriteLine("Dec Key: " + bytesToHex(PK1Dec(tempKey, keyVec1, false))); Debug.WriteLine("\n\n"); } }
public Section(ArraySlice slice) { offset = slice.getLong(); flags = slice.getByte(); val = (slice.getByte() << 16) | (slice.getByte() << 8) | (slice.getByte()); }