Struct self_encryption::SequentialEncryptor[][src]

pub struct SequentialEncryptor<S: Storage + 'static + Send + Sync + Clone> { /* fields omitted */ }
Expand description

An encryptor which only permits sequential writes, i.e. there is no ability to specify an offset in the write() call; all data is appended sequentially.

The resulting chunks and DataMap are identical to those which would have been produced by a [SelfEncryptor].

This encryptor differs from SelfEncryptor in that completed chunks will be stored during write() calls as opposed to buffering all data until the close() call. This should give more realistic feedback about the progress of fully self_encrypting larger data.

A further difference is that since the entire data is not held in an internal buffer, this encryptor doesn’t need to limit the input data size, i.e. MAX_FILE_SIZE does not apply to this encryptor. (Note that as of writing, there is no way to decrypt data which exceeds this size, since the only decryptor available is SelfEncryptor, and this does limit the data size to MAX_FILE_SIZE.)

Due to the reduced complexity, a side effect is that this encryptor outperforms SelfEncryptor, particularly for small data (below MIN_CHUNK_SIZE * 3 bytes) where no chunks are generated.

Implementations

Creates an Encryptor, using an existing DataMap if data_map is not None.

Buffers some or all of data and stores any completed chunks (i.e. those which cannot be modified by subsequent write() calls). The internal buffers can only be flushed by calling close().

This finalises the encryptor - it should not be used again after this call. Internal buffers are flushed, resulting in up to four chunks being stored.

Number of bytes of data written, including those handled by previous encryptors.

E.g. if this encryptor was constructed with a DataMap whose len() yields 100, and it then handles a write() of 100 bytes, len() will return 200.

Returns true if len() == 0.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.