Exemple #1
0
        public override void Close()
        {
            //encrypt before closing
            SkipToNextBoundary();            //pad so total length is divisible by 8
            int length = (int)BaseStream.Position;

            byte[] buffer = new byte[length];

            BaseStream.Seek(0, SeekOrigin.Begin);
            BaseStream.Read(buffer, 0, length);

            if (format != CryptApi.NoxCryptFormat.NONE)
            {
                buffer = CryptApi.NoxEncrypt(buffer, format);
            }

            BaseStream.Seek(0, SeekOrigin.Begin);
            Write(buffer);
            base.Close();
        }