Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }