public void WriteStartWithHmac(Stream hmacStream)
        {
            if (hmacStream == null)
            {
                throw new ArgumentNullException("hmacStream");
            }

            AxCrypt1Guid.Write(hmacStream);

            PreambleHeaderBlock preambleHeaderBlock = _headers.FindHeaderBlock <PreambleHeaderBlock>();

            preambleHeaderBlock.Write(hmacStream);

            WriteGeneralHeaders(hmacStream);

            DataHeaderBlock dataHeaderBlock = _headers.FindHeaderBlock <DataHeaderBlock>();

            dataHeaderBlock.Write(hmacStream);
        }
        private void WriteInternal(Stream cipherStream, Stream hmacStream)
        {
            cipherStream.Position = 0;
            AxCrypt1Guid.Write(cipherStream);
            PreambleHeaderBlock preambleHaderBlock = _headers.FindHeaderBlock <PreambleHeaderBlock>();

            preambleHaderBlock.Write(cipherStream);
            foreach (HeaderBlock headerBlock in _headers.HeaderBlocks)
            {
                if (headerBlock is DataHeaderBlock)
                {
                    continue;
                }
                if (headerBlock is PreambleHeaderBlock)
                {
                    continue;
                }
                headerBlock.Write(hmacStream);
            }
            DataHeaderBlock dataHeaderBlock = _headers.FindHeaderBlock <DataHeaderBlock>();

            dataHeaderBlock.Write(hmacStream);
        }
Пример #3
0
        public override object Clone()
        {
            DataHeaderBlock block = new DataHeaderBlock((byte[])GetDataBlockBytesReference().Clone());

            return(block);
        }