static void GetAesParameters(BlamVersion game, CacheSectionType type, out byte[] key, out byte[] iv) { switch (game) { case BlamVersion.HaloReach_Beta: key = kAesBeta.Key; iv = kAesBeta.Iv; break; case BlamVersion.HaloReach_Xbox: if (type == CacheSectionType.Localization) { key = kAesRetail[0].Key; iv = kAesRetail[0].Iv; } else if (type == CacheSectionType.Debug) { key = kAesRetail[1].Key; iv = kAesRetail[1].Iv; } else if (type == CacheSectionType.Tag) { key = kAesRetail[2].Key; iv = kAesRetail[2].Iv; } else { goto default; } break; default: throw new Debug.Exceptions.UnreachableException(string.Format("{0}/{1}", game.ToString(), type.ToString())); } }
public SectionInterop this[CacheSectionType type] { get { int index = (int)type; return(sections[index]); } }
internal virtual byte[] DecryptCacheSegmentBytes(CacheSectionType section_type, int segment_offset, int segment_size) { InputStream.Seek(segment_offset); uint buffer_size = Util.Align(16, (uint)segment_size); byte[] bytes = InputStream.ReadBytes(buffer_size); return(bytes); }
internal override byte[] DecryptCacheSegmentBytes(CacheSectionType section_type, int segment_offset, int segment_size) { InputStream.Seek(segment_offset); uint buffer_size = Util.Align(16, (uint)segment_size); byte[] encrypted = InputStream.ReadBytes(buffer_size); byte[] decrypted; GameDefinition.SecurityAesDecrypt(engineVersion, section_type, encrypted, out decrypted); return(decrypted != null ? decrypted : null); }
internal IO.EndianReader DecryptCacheSegmentStream(CacheSectionType section_type, int segment_offset, int segment_size) { byte[] bytes = DecryptCacheSegmentBytes(section_type, segment_offset, segment_size); return(bytes != null ? new IO.EndianReader(bytes) : null); }
internal IO.EndianReader DecryptCacheSegment(CacheSectionType section_type, int segment_offset, int segment_size) { InputStream.Seek(segment_offset); uint buffer_size = Util.Align(16, (uint)segment_size); byte[] encrypted = InputStream.ReadBytes(buffer_size); byte[] decrypted; GameDefinition.SecurityAesDecrypt(engineVersion, section_type, encrypted, out decrypted); return decrypted != null ? new IO.EndianReader(decrypted) : null; }
internal static void SecurityAesDecrypt(BlamVersion game, CacheSectionType section_type, byte[] input, out byte[] output) { SecurityAesDecrypt(game, section_type, input, out output, GetAesParameters); }
public SectionInterop this[CacheSectionType type] { get { int index = (int)type; return sections[index]; } }
static void GetAesParameters(BlamVersion game, CacheSectionType type, out byte[] key, out byte[] iv) { switch (game) { case BlamVersion.Halo4_Xbox: if (type == CacheSectionType.Localization) { key = kAesRetail[0].Key; iv = kAesRetail[0].Iv; } else if (type == CacheSectionType.Debug) { key = kAesRetail[1].Key; iv = kAesRetail[1].Iv; } else if (type == CacheSectionType.Tag) { key = kAesRetail[2].Key; iv = kAesRetail[2].Iv; } else goto default; break; default: throw new Debug.Exceptions.UnreachableException(string.Format("{0}/{1}", game.ToString(), type.ToString())); } }