Zbox Logo

Keep App Files Securely and Privately

Zbox is a zero-details, privacy-focused embeddable file system

Get Started

How It Works

100% Encrypted, Privacy Reserved Repository

Encrypted by state-of-the-art crypto, files, directories and metadata are encapsulated in a highly secure repository, which makes data leakage impossible.

Exclusive Access, In-App File System

A dedicated and isolated file system running completely inside your app, no other processes can access your precious data.

No-Knowledge, Plugable Storages

Memory, on-disk files, RDBMS and key-value object store can all be plugged as underlying storage, while having zero knowledge of your data.


  • Everything is encrypted, including metadata and directory structure
  • State-of-the-art cryptography: AES-256-GCM (hardware), XChaCha20-Poly1305, Argon2 and etc.
  • Multiple storages, including memory, OS file system, RDBMS, key-value object store
  • Content-based data chunk deduplication and file-based deduplication
  • Data compression using LZ4 in fast mode
  • Data integrity is guaranteed by authenticated encryption primitives (AEAD crypto)
  • File contents versioning
  • Copy-on-write (COW) semantics
  • ACID transactional operations

Get Started

  1. Install libsodium as dependency

  2. Add the following dependency to your Cargo.toml

    zbox = "0.6.1"
  3. Add zbox as extern crate in your lib.rs or main.rs file

    extern crate zbox;
  4. A simple "Hello, world!" example:

    extern crate zbox;
    use std::io::{Seek, SeekFrom, Read, Write};
    use zbox::{init_env, RepoOpener, OpenOptions};
    fn main() {
        // initialise zbox environment, called first
        // create and open a repository in current OS directory
        let mut repo = RepoOpener::new()
            .open("file://./my_repo", "your password")
        // create and open a file in repository for writing
        let mut file = OpenOptions::new()
            .open(&mut repo, "/my_file.txt")
        // use std::io::Write trait to write data into it
        file.write_all(b"Hello, world!").unwrap();
        // finish writing to make a permanent version of content
        // read file content using std::io::Read trait
        let mut content = String::new();
        file.read_to_string(&mut content).unwrap();
        assert_eq!(content, "Hello, world!");
  5. Start coding by reading the documentation or source code. Have fun!

  1. Install libsodium as dependency

  2. Clone Zbox source code from GitHub: https://github.com/zboxfs/zbox

  3. Go to the source code directory, then follow the ritual:

    make && make install
  4. A simple "Hello, world!" example in C:

    #include <stdint.h>
    #include <stdio.h>
    #include <string.h>
    #include <assert.h>
    #include "zbox.h"
    int main() {
        const char *uri = "mem://repo";
        const char *pwd = "pwd";
        int ret;
        // initialise zbox environment, called first
        ret = zbox_init_env();
        // create a repo opener
        zbox_opener opener = zbox_create_opener();
        zbox_opener_create(opener, true);
        // open a repo
        zbox_repo repo;
        ret = zbox_open_repo(&repo, opener, uri, pwd);
        // free the repo opener
        // create a file for read/write
        zbox_file file;
        ret = zbox_repo_create_file(&file, repo, "/file");
        // write to file and finish it to make a permanent version of content
        const char *buf = "Hello, world!";
        size_t buf_len = strlen(buf);
        ret = zbox_file_write(file, (const uint8_t*)buf, buf_len);
        assert(ret == buf_len);
        ret = zbox_file_finish(file);
        // read file
        char dst[32] = { 0 };
        ret = zbox_file_read((uint8_t*)dst, buf_len, file);
        assert(ret == buf_len);
        assert(!memcmp(dst, buf, buf_len));
        // close file and repo
        return 0;
  5. Find more examples in Zbox source code. Have fun!