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; }
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; }