예제 #1
0
        public static void DumpHeader(byte[] xciHeaderData)
        {
            byte[] array1 = ((IEnumerable <byte>)xciHeaderData).Skip <byte>(256).ToArray <byte>();
            Aes128CbcCryptoDriver aes128CbcCryptoDriver = new Aes128CbcCryptoDriver(Aes128KeyIndex.XciHeader);

            byte[] array2 = ((IEnumerable <byte>)array1).Skip <byte>(XciMeta.GetIvOffset()).Take <byte>(XciInfo.IvSize).ToArray <byte>();
            byte[] iv     = new byte[array2.Length];
            for (int index = 0; index < array2.Length; ++index)
            {
                iv[index] = array2[array2.Length - 1 - index];
            }
            aes128CbcCryptoDriver.DecryptBlock(iv, array1, XciMeta.GetEncryptionTargetOffset(), XciMeta.GetEncryptionTargetSize(), array1, XciMeta.GetEncryptionTargetOffset());
            XciMeta.DumpHeader(array1);
        }
예제 #2
0
        public ByteData PullData(long offset, int size)
        {
            ByteData byteData = this.m_rootPartitionFsHeaderHashSource.PullData(0L, 32);

            this.m_xciInfo.partitionFsHeaderHash = new byte[32];
            ArraySegment <byte> buffer = byteData.Buffer;

            byte[] array1 = buffer.Array;
            buffer = byteData.Buffer;
            int offset1 = buffer.Offset;

            byte[] partitionFsHeaderHash = this.m_xciInfo.partitionFsHeaderHash;
            int    dstOffset             = 0;

            buffer = byteData.Buffer;
            int count = buffer.Count;

            Buffer.BlockCopy((Array)array1, offset1, (Array)partitionFsHeaderHash, dstOffset, count);
            byte[] header = this.m_xciMeta.CreateHeader(this.m_xciInfo);
            this.m_headerEncryptor.EncryptBlock(this.m_xciInfo.iv, header, XciMeta.GetEncryptionTargetOffset(), XciMeta.GetEncryptionTargetSize(), header, XciMeta.GetEncryptionTargetOffset());
            byte[] array2 = ((IEnumerable <byte>) this.m_headerSigner.SignBlock(header, 0, header.Length)).Concat <byte>((IEnumerable <byte>)header).ToArray <byte>();
            return(new ByteData(new ArraySegment <byte>(array2, 0, array2.Length)));
        }