var searchIndex = {}; searchIndex["self_encryption"] = {"doc":"A file **content** self-encryptor.","items":[[3,"ChunkDetails","self_encryption","Holds pre- and post-encryption hashes as well as the original (pre-compression) size for a given\nchunk.",null,null],[12,"chunk_num","","Index number (starts at 0)",0,null],[12,"hash","","Post-encryption hash of chunk",0,null],[12,"pre_hash","","Pre-encryption hash of chunk",0,null],[12,"source_size","","Size before encryption (compression alters this as well as any possible padding depending\non cipher used)",0,null],[3,"SelfEncryptor","","This is the encryption object and all file handling should be done using this object as the low\nlevel mechanism to read and write *content*. This library has no knowledge of file metadata.",null,null],[3,"SequentialEncryptor","","An encryptor which only permits sequential writes, i.e. there is no ability to specify an offset\nin the `write()` call; all data is appended sequentially.",null,null],[4,"DataMap","","Holds the information that is required to recover the content of the encrypted file. Depending\non the file size, this is held as a vector of `ChunkDetails`, or as raw data.",null,null],[13,"Chunks","","If the file is large enough (larger than 3072 bytes, 3 * MIN_CHUNK_SIZE), this algorithm\nholds the list of the files chunks and corresponding hashes.",1,null],[13,"Content","","Very small files (less than 3072 bytes, 3 * MIN_CHUNK_SIZE) are not split into chunks and\nare put in here in their entirety.",1,null],[13,"None","","empty datamap",1,null],[4,"SelfEncryptionError","","Errors which can arise during self-encryption or -decryption.",null,null],[13,"Compression","","An error during compression or decompression.",2,null],[13,"Decryption","","An error within the symmetric encryption or decryption process.",2,null],[13,"Io","","A generic I/O error, likely arising from use of memmap.",2,null],[13,"Storage","","An error in putting or retrieving chunks from the storage object.",2,null],[11,"default","","",0,{"inputs":[],"output":{"name":"chunkdetails"}}],[11,"clone","","",0,null],[11,"cmp","","",0,null],[11,"partial_cmp","","",0,null],[11,"lt","","",0,null],[11,"le","","",0,null],[11,"gt","","",0,null],[11,"ge","","",0,null],[11,"eq","","",0,null],[11,"ne","","",0,null],[11,"decode","","",0,{"inputs":[{"name":"__d"}],"output":{"name":"result"}}],[11,"encode","","",0,null],[11,"new","","Holds information required for successful recovery of a chunk, as well as for the\nencryption/decryption of it's two immediate successors, modulo the number of chunks in the\ncorresponding DataMap.",0,{"inputs":[],"output":{"name":"chunkdetails"}}],[11,"fmt","","",0,null],[11,"clone","","",1,null],[11,"cmp","","",1,null],[11,"partial_cmp","","",1,null],[11,"lt","","",1,null],[11,"le","","",1,null],[11,"gt","","",1,null],[11,"ge","","",1,null],[11,"eq","","",1,null],[11,"ne","","",1,null],[11,"decode","","",1,{"inputs":[{"name":"__d"}],"output":{"name":"result"}}],[11,"encode","","",1,null],[11,"len","","Original (pre-encryption) size of file in DataMap.",1,null],[11,"get_chunks","","Returns the list of chunks pre and post encryption hashes if present.",1,null],[11,"get_sorted_chunks","","The algorithm requires this to be a sorted list to allow get_pad_iv_key to obtain the\ncorrect pre-encryption hashes for decryption/encryption.",1,null],[11,"has_chunks","","Whether the content is stored as chunks or as raw data.",1,null],[11,"fmt","","",1,null],[11,"fmt","","",2,null],[11,"fmt","","",2,null],[11,"description","","",2,null],[11,"from","","",2,{"inputs":[{"name":"compressionerror"}],"output":{"name":"selfencryptionerror"}}],[11,"from","","",2,{"inputs":[{"name":"decryptionerror"}],"output":{"name":"selfencryptionerror"}}],[11,"from","","",2,{"inputs":[{"name":"ioerror"}],"output":{"name":"selfencryptionerror"}}],[11,"from","","",2,{"inputs":[{"name":"e"}],"output":{"name":"selfencryptionerror"}}],[11,"new","","This is the only constructor for an encryptor object. Each `SelfEncryptor` is used for a\nsingle file. The parameters are a `Storage` object and a `DataMap`. For a file which has\nnot previously been self-encrypted, use `DataMap::None`.",3,{"inputs":[{"name":"s"},{"name":"datamap"}],"output":{"name":"result"}}],[11,"write","","Write method mirrors a POSIX type write mechanism. It loosely mimics a filesystem interface\nfor easy connection to FUSE-like programs as well as fine grained access to system level\nlibraries for developers. The input `data` will be written from the specified `position`\n(starts from 0).",3,null],[11,"read","","The returned content is read from the specified `position` with specified `length`. Trying\nto read beyond the file size will cause the encryptor to return content filled with `0u8`s\nin the gap (file size isn't affected). Any other unwritten gaps will also be filled with\n'0u8's.",3,null],[11,"close","","This function returns a `DataMap`, which is the info required to recover encrypted content\nfrom data storage location. Content temporarily held in the encryptor will only get flushed\ninto storage when this function gets called.",3,null],[11,"truncate","","Truncate the self_encryptor to the specified size (if extended, filled with `0u8`s).",3,null],[11,"len","","Current file size as is known by encryptor.",3,null],[11,"is_empty","","Returns true if file size as is known by encryptor == 0.",3,null],[11,"fmt","","",3,null],[11,"new","","Creates an `Encryptor`, using an existing `DataMap` if `data_map` is not `None`.",4,{"inputs":[{"name":"s"},{"name":"option"}],"output":{"name":"result"}}],[11,"write","","Buffers some or all of `data` and stores any completed chunks (i.e. those which cannot be\nmodified by subsequent `write()` calls). The internal buffers can only be flushed by\ncalling `close()`.",4,null],[11,"close","","This finalises the encryptor - it should not be used again after this call. Internal\nbuffers are flushed, resulting in up to four chunks being stored.",4,null],[11,"len","","Number of bytes of data written, including those handled by previous encryptors.",4,null],[11,"is_empty","","Returns true if `len() == 0`.",4,null],[17,"MAX_FILE_SIZE","","The maximum size of file which can be self-encrypted, defined as 1GB.",null,null],[17,"MAX_CHUNK_SIZE","","The maximum size (before compression) of an individual chunk of the file, defined as 1MB.",null,null],[17,"MIN_CHUNK_SIZE","","The minimum size (before compression) of an individual chunk of the file, defined as 1kB.",null,null],[17,"COMPRESSION_QUALITY","","Controls the compression-speed vs compression-density tradeoffs. The higher the quality, the\nslower the compression. Range is 0 to 11.",null,null],[8,"Storage","","Trait which must be implemented by storage objects to be used in self-encryption. Data is\npassed to the storage object encrypted with `name` being the SHA512 hash of `data`. `Storage`\ncould be implemented as an in-memory `HashMap` or a disk-based container for example.",null,null],[10,"get","","Retrieve data previously `put` under `name`. If the data does not exist, an error should be\nreturned.",5,null],[10,"put","","Store `data` under `name`.",5,null],[8,"StorageError","","Trait inherited from `std::error::Error` representing errors which can be returned by the\n`Storage` object.",null,null]],"paths":[[3,"ChunkDetails"],[4,"DataMap"],[4,"SelfEncryptionError"],[3,"SelfEncryptor"],[3,"SequentialEncryptor"],[8,"Storage"]]}; initSearch(searchIndex);