20 unstable releases (3 breaking)

0.7.5 Nov 8, 2024
0.7.4 Oct 24, 2024
0.7.2 Sep 27, 2024
0.6.8 Jul 31, 2024
0.4.3 Jan 22, 2024

#1200 in Cryptography

Download history 3/week @ 2024-08-15 2/week @ 2024-08-22 156/week @ 2024-08-29 24/week @ 2024-09-05 156/week @ 2024-09-12 109/week @ 2024-09-19 219/week @ 2024-09-26 16/week @ 2024-10-03 6/week @ 2024-10-10 160/week @ 2024-10-17 132/week @ 2024-10-24 11/week @ 2024-10-31 123/week @ 2024-11-07 7/week @ 2024-11-14 7/week @ 2024-11-21 1/week @ 2024-11-28

140 downloads per month
Used in 2 crates

MIT license

85KB
1K SLoC

nuts: A secure storage toolset.

Introduction

The nuts library implements a secure storage library, where data are stored in a container. The container is divided into encrypted blocks. So a nuts container looks like a block device. All the things (e.g. keys) you need to open it are stored in the container itself. The library has a rich API, so it can be easily integrated into you application.

The container does not manage the encrypted data itself. It is transferred to a backend that is solely responsible for the persistent storage of the blocks. In this way, the data can easily be stored on different media or in different formats. The keys remain in the container and are not stored in the backend.

The nuts-archive is an application based on the nuts container. Inspired by the tar tool you can store files, directories and symlinks in a nuts container.

The nuts commandline utility is used to maintain nuts container and its application.

Getting started

Installation

The easiest way to try out the nuts tool is in a Docker container:

docker pull dorobin/nuts

Then open a shell in a container:

docker run -it dorobin/nuts bash
root@92cdafaf933b:/# # you are inside the container
root@92cdafaf933b:/# # the nuts tool is installed as /usr/local/bin/nuts
root@92cdafaf933b:/# ls /usr/local/bin/nuts
/usr/local/bin/nuts

Alternatively, the nuts tool and its backend can be installed using cargo install:

Install the nuts tool:

cargo install nuts-tool

Install the nuts-directory backend as a plugin:

cargo install nuts-directory --features=plugin

Configure the plugin

The plugin must be configured for the nuts tool:

nuts plugin add directory --path nuts-directory
  • directory is the name of the plugin. You can use this identifier to identify the plugin.
  • nuts-directory is the path to the plugin executable.

Note: If you are using the Docker image, this step is not necessary. The plugin is already configured in the image.

Create a container

The following command creates a container with the name sample, which uses the directory plugin:

nuts container create sample --plugin=directory

Retrieve some basic information from the container:

NUTS_CONTAINER=sample nuts container info

The nuts tool evaluates the NUTS_CONTAINER environment variable to determine which container to use. Alternatively, the --container commandline option can be used.

Create an archive on top of the container

NUTS_CONTAINER=sample nuts archive create

Put a local file into the archive:

echo "hello world" > f1.txt
NUTS_CONTAINER=sample nuts archive add f1.txt

List the content of the archive:

NUTS_CONTAINER=sample nuts archive list

Retrieve a file from the archive:

NUTS_CONTAINER=sample nuts archive get f1.txt

lib.rs:

A sample nuts_backend::Backend implementation which stores the data in memory.

This implementation is mainly used for demonstration, testing and documentation.

It stores the content of the data blocks in a hash indexed by the Id of this backend, where the id is a simple u32 value.

Dependencies

~0.3–1MB
~22K SLoC