Пример #1
0
        public byte[] GetAsData()
        {
            BigEndianMemoryStream buffer = new BigEndianMemoryStream(GetDataSize());

            buffer.WriteBigEndian(signatureType);
            buffer.Write(signature);
            buffer.Seek(60, SeekOrigin.Current);
            buffer.Write(issuer);

            buffer.WriteByte(version);
            buffer.WriteByte(CACRLVersion);
            buffer.WriteByte(signerCRLVersion);
            buffer.Seek(1, SeekOrigin.Current);

            buffer.WriteBigEndian(systemVersion);
            buffer.WriteBigEndian(ticket.titleID);
            buffer.WriteBigEndian(titleType);
            buffer.WriteBigEndian(groupID);
            buffer.WriteBigEndian(appType);
            buffer.Seek(58, SeekOrigin.Current);
            buffer.WriteBigEndian(accessRights);
            buffer.WriteBigEndian(titleVersion);
            buffer.WriteBigEndian(contentCount);
            buffer.WriteBigEndian(bootIndex);
            buffer.Seek(2, SeekOrigin.Current);

            buffer.Write(SHA2);

            buffer.Write(contentInfo.GetAsData());
            buffer.Write(contents.GetAsData());

            return(buffer.GetBuffer());
        }
Пример #2
0
        public byte[] GetAsData()
        {
            Random rdm = new Random();
            BigEndianMemoryStream buffer = new BigEndianMemoryStream(0x350);

            buffer.Write(Utils.HexStringToByteArray("00010004"));
            byte[] randomData = new byte[0x100];
            rdm.NextBytes(randomData);
            buffer.Write(randomData);
            buffer.Seek(0x3C, SeekOrigin.Current);
            buffer.Write(Utils.HexStringToByteArray("526F6F742D434130303030303030332D58533030303030303063000000000000"));
            buffer.Seek(0x5C, SeekOrigin.Current);
            buffer.Write(Utils.HexStringToByteArray("010000"));
            buffer.Write(GetEncryptedKey().key);
            buffer.Write(Utils.HexStringToByteArray("000005"));
            randomData = new byte[0x06];
            rdm.NextBytes(randomData);
            buffer.Write(randomData);
            buffer.Seek(0x04, SeekOrigin.Current);
            buffer.WriteBigEndian(titleID);
            buffer.Write(Utils.HexStringToByteArray("00000011000000000000000000000005"));
            buffer.Seek(0xB0, SeekOrigin.Current);
            buffer.Write(Utils.HexStringToByteArray("00010014000000AC000000140001001400000000000000280000000100000084000000840003000000000000FFFFFF01"));
            buffer.Seek(0x7C, SeekOrigin.Current);

            return(buffer.GetBuffer());
        }
Пример #3
0
        public byte[] GetAsData()
        {
            BigEndianMemoryStream buffer = new BigEndianMemoryStream(GetDataSize());

            if (isRoot)
            {
                buffer.WriteByte(1);
                buffer.Seek(7, SeekOrigin.Current);
                buffer.WriteBigEndian(rootEntryCount);
                buffer.Seek(4, SeekOrigin.Current);
            }
            else
            {
                buffer.WriteByte(GetTypeAsByte());
                buffer.WriteByte((byte)(nameOffset >> 16)); // We need to write a 24bit int (big endian)
                buffer.WriteByte((byte)(nameOffset >> 8));
                buffer.WriteByte((byte)nameOffset);

                if (isDir)
                {
                    buffer.WriteBigEndian(parentOffset);
                    buffer.WriteBigEndian(nextOffset);
                }
                else
                {
                    buffer.WriteBigEndian((int)(fileOffset >> 5));
                    buffer.WriteBigEndian((int)fileSize);
                }

                buffer.WriteBigEndian(flags);
                buffer.WriteBigEndian((short)content.ID);
            }

            foreach (FSTEntry entry in children)
            {
                buffer.Write(entry.GetAsData());
            }

            return(buffer.GetBuffer());
        }
Пример #4
0
        public byte[] GetAsData()
        {
            BigEndianMemoryStream buffer = new BigEndianMemoryStream(GetDataSize());

            buffer.Write(magicbytes);
            buffer.WriteBigEndian(unknown);
            buffer.WriteBigEndian(contentCount);
            buffer.Seek(20, SeekOrigin.Current);
            buffer.Write(contents.GetFSTContentHeaderAsData());
            buffer.Write(fileEntries.GetAsData());
            buffer.Write(strings.ToArray());

            return(buffer.GetBuffer());
        }