maidsafe / self_encryption

file self encryptor
Other
118 stars 70 forks source link

No chunk created for very small file #54

Closed pascaldimassimo closed 9 years ago

pascaldimassimo commented 9 years ago

Hi,

I've just started to play with this library. I am using the sample code from example/basic_encryptor.rs. When trying to encrypt a very small file (< 20 characters), no chunk is written to chunk_store_test. But the data_map seems fine, because I can decrypt and retrieve back my original file. If I try with a bigger file, I've got chunks in chunk_store_test directory. Is that normal?

If that helps, I'm using rustc 1.0.0-nightly (2baf34825 2015-04-21) (built 2015-04-22)

Thanks!

dirvine commented 9 years ago

Yes that is by design. The use case for us at least is you really want to keep the datamaps and we add them to a directory structure (with metadata per file) and these then go through self_encryption again. So they are encrypted. It does not make much sense to produce chunks that are bigger than the small content so we add very small content to the datamap. This is OK though as the datamaps when put together in a blob of any kind should be put through encryption again.

then you need to protect the root datamap (or structure) as a separate issue.

pascaldimassimo commented 9 years ago

Thanks for the explanation!