zboxfs / zbox

Zero-details, privacy-focused in-app file system.
https://zbox.io/fs/
Apache License 2.0
1.53k stars 74 forks source link

Deeper explanation in website or docs #35

Closed charleschege closed 4 years ago

charleschege commented 5 years ago

The current explanation on the website is shallow and does not go deep into the internal workings of the library. For instance "Multiple storages, including memory, OS file system, RDBMS, key-value object store" does not explain how to interact with other storage systems like memory or RDBMS.

Another example, "State-of-the-art cryptography: AES-256-GCM (hardware), XChaCha20-Poly1305, Argon2 and etc." does not explain which is cryptography is used by default or how it's all interconnected.

It would be great if you explained more, or gave a document detailing the internal architecture of zbox.

Also the chat on gitter seems abandoned

burmecia commented 5 years ago

Thanks for you suggestions. Yes, the current document is very minimal and not deep in details. This is definitely the next thing I will focus to improve. As for now, I can give some simple explanations for your questions.

  1. The underlying storage implementation is decoupled with zbox fs, the interface between them is through the Storable trait object: https://github.com/zboxfs/zbox/blob/068d1abd3c4374fb6358675087bb982d23ba9873/src/volume/storage/mod.rs#L44 Storage must implement this trait with some guarantees, which is mentioned in the code. Data passed down to the storage is already encrypted and chunked to 8KB blocks, so the underlying storage have no knowledge about the file system. There are some storage implementations already in the storage folder (https://github.com/zboxfs/zbox/tree/master/src/volume/storage)

  2. The crypto primitives is provided by libsodium. You can choose AES or XChacha when creating a repo. By default, it will choose AES if AES-NI instrunction set is available in CPU, otherwise fallback to XChacha. Argon2 is used for hashing, which is also provided by libsodium. So basically zbox fs fully depends on libsodium and doesn't do any cryptography itself because this part is hard and critical.

Hope this is helpful and the future document will give more details on the this.

charleschege commented 5 years ago

If I use zbox on arm processors, does it default to XChaCha or AES?

burmecia commented 5 years ago

I would say it depends on how libsodium deal with it, seems like AArch64 can use hardeware AES instruction set. Check this: https://github.com/jedisct1/libsodium/issues/363

charleschege commented 5 years ago

If I encrypt a repo with AES on Desktop, would I be able to decrypt it using XChaCha on Arm?

burmecia commented 5 years ago

No, you cannot. The crypto, including cipher and cost, must be exactly same to encrypt and decrypt.

charleschege commented 5 years ago

That makes sense. Where in the docs can I make XChaCha the default. I am only finding the enum XChaCha

burmecia commented 4 years ago

Hope this new page https://zbox.io/fs can provide more architectural view about the internal of ZboxFS. I will write up more details of each module in blogs later on. Close this for now.