コード例 #1
0
ファイル: seedinfo.cs プロジェクト: LITTOMA/CEED-Mini-EN
        public SEEDEntry(SEEDEntry entry)
        {
            TitleID = entry.TitleID;
            SEED = entry.SEED;
            byte[] temp;
            SHA256 sha256 = new SHA256Managed();

            //Compute Checksum
            temp = new byte[24];
            Array.Copy(SEED, 0, temp, 0, 16);
            Array.Copy(TitleID, 0, temp, 16, 8);
            Checksum = BitConverter.ToUInt32(sha256.ComputeHash(temp), 0);
        }
コード例 #2
0
ファイル: seedinfo.cs プロジェクト: LITTOMA/CEED-Mini-EN
        public SEEDEntry(SEEDEntry entry, byte[] oldKeyY)
        {
            TitleID = entry.TitleID;
            SEED = entry.SEED;
            KeyY = oldKeyY;

            //Compute new KeyY
            byte[] temp = new byte[32];
            Array.Copy(oldKeyY, 0, temp, 0, 16);
            Array.Copy(SEED, 0, temp, 16, 16);
            SHA256 sha256 = new SHA256Managed();
            Array.Copy(sha256.ComputeHash(temp), 0, KeyY, 0, 16);
        }
コード例 #3
0
ファイル: ncchinfo.cs プロジェクト: LITTOMA/CEED-Mini-EN
        public NCCHInfo(NCCH ncch, int PartitionIndex, Encoding encoding)
        {
            Entries = new List<NCCHInfoEntry>();
            int Use7x = ncch.Header.Flags[3];

            if ((ncch.Header.Flags[7] & 0x20) == 0x20)
            {
                if (!File.Exists("seedinfo.bin"))
                    throw new Exception("Cannot find seedinfo.bin.");
                seedinfo = new SEEDinfo("seedinfo.bin");
                for (int i = 0; i < seedinfo.Count; i++)
                {
                    if (seedinfo.Entries[i].Checksum == ncch.Header.SEEDCheck)
                    {
                        byte[] KeyY = new byte[16];
                        Array.Copy(ncch.Header.NCCHHeaderSignature, 0, KeyY, 0, 16);
                        seedinfo.Entries[i] = new SEEDEntry(seedinfo.Entries[i], KeyY);
                        SEED = seedinfo.Entries[i];
                        break;
                    }
                }
            }

            if (ncch.Header.ExtendedHeaderSize > 0)
            {
                Entries.Add(new NCCHInfoEntry(ncch, PartitionIndex, NcchSection.exheader, encoding, 0, "exheader"));
            }
            if (ncch.Header.ExeFSLength > 0)
            {
                Entries.Add(new NCCHInfoEntry(ncch, PartitionIndex, NcchSection.exefs, encoding, 0, "exefs_norm"));
                if (Use7x == 1)
                {
                    Entries.Add(new NCCHInfoEntry(ncch, PartitionIndex, NcchSection.exefs, encoding, Use7x, "exefs_7x"));
                }
            }
            if (ncch.Header.RomFSLength > 0)
            {
                Entries.Add(new NCCHInfoEntry(ncch, PartitionIndex, NcchSection.romfs, encoding, Use7x, "romfs"));
            }
        }
コード例 #4
0
ファイル: seedinfo.cs プロジェクト: LITTOMA/CEED-Mini-EN
        public void FromStream(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            Magic = new string(reader.ReadChars(4));
            if (Magic != "SEED")
                throw new Exception("不是有效的seedinfo文件");
            Count = reader.ReadInt32();

            for (int i = 0; i < Count; i++)
            {
                Entries.Add(new SEEDEntry(reader.ReadBytes(8)));
            }
            for (int i = 0; i < Count; i++)
            {
                Entries[i].SEED = reader.ReadBytes(16);
            }
            for (int i = 0; i < Count; i++)
            {
                Entries[i] = new SEEDEntry(Entries[i]);
            }
        }