Пример #1
0
        internal AssuredStreamHeader(AssuredStreamCreateArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            args.VerifyArgs("args");

            _fileType = args.FileType;
            _hashType = args.HashType;

            if (args.StrongNameKey == null)
            {
                _fileHash      = new byte[QQnCryptoHelpers.GetHashBits(_hashType) / 8];
                _hashSignature = new byte[0];
            }
            else
            {
                _snk           = args.StrongNameKey;
                _fileHash      = new byte[_snk.HashLength];
                _hashSignature = new byte[_snk.SignatureLength];
                _hashType      = _snk.HashType;
            }
            _guid = args.NullGuid ? Guid.Empty : Guid.NewGuid();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssuredStream"/> class.
        /// </summary>
        /// <param name="stream">The stream.</param>
        /// <param name="args">The args.</param>
        public AssuredStream(Stream stream, AssuredStreamCreateArgs args)
            : this(stream, true)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }

            args.VerifyArgs("args");

            long pos = stream.Position;

            _header = new AssuredStreamHeader(args);
            _header.WriteHeader(stream);

            _basePosition = stream.Position;
        }