Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 6
0
		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;
		}
Ejemplo n.º 7
0
 internal static void SecurityAesDecrypt(BlamVersion game, CacheSectionType section_type, byte[] input, out byte[] output)
 {
     SecurityAesDecrypt(game, section_type, input, out output, GetAesParameters);
 }
Ejemplo n.º 8
0
			public SectionInterop this[CacheSectionType type] { get {
				int index = (int)type;

				return sections[index];
			} }
Ejemplo n.º 9
0
		internal static void SecurityAesDecrypt(BlamVersion game, CacheSectionType section_type, byte[] input, out byte[] output)
		{
			SecurityAesDecrypt(game, section_type, input, out output, GetAesParameters);
		}
Ejemplo n.º 10
0
		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()));
			}
		}