コード例 #1
0
		public SeekableCryptoStream(EncryptionSettings encryptionSettings, string key, Stream stream)
		{
			if (!stream.CanRead)
				throw new ArgumentException("The Underlying stream for a SeekableCryptoStream must always be either read-only or read-write. Write only streams are not supported.");
			if (!stream.CanSeek)
				throw new ArgumentException("The Underlying stream for a SeekableCryptoStream must be seekable.");

			isReadonly = !stream.CanWrite;

			underlyingStream = new BlockReaderWriter(encryptionSettings, key, stream, Constants.DefaultIndexFileBlockSize);
			currentBlockSize = underlyingStream.Header.DecryptedBlockSize;
		}
コード例 #2
0
        public SeekableCryptoStream(EncryptionSettings encryptionSettings, string key, Stream stream)
        {
            if (!stream.CanRead)
            {
                throw new ArgumentException("The Underlying stream for a SeekableCryptoStream must always be either read-only or read-write. Write only streams are not supported.");
            }
            if (!stream.CanSeek)
            {
                throw new ArgumentException("The Underlying stream for a SeekableCryptoStream must be seekable.");
            }

            isReadonly = !stream.CanWrite;

            underlyingStream = new BlockReaderWriter(encryptionSettings, key, stream, Constants.DefaultIndexFileBlockSize);
            currentBlockSize = underlyingStream.Header.DecryptedBlockSize;
        }