14 releases

0.7.4 Oct 24, 2024
0.7.3 Oct 17, 2024
0.7.2 Sep 27, 2024
0.6.8 Jul 31, 2024
0.6.2 May 23, 2024

#746 in Cryptography

Download history 134/week @ 2024-07-28 4/week @ 2024-08-04 6/week @ 2024-08-11 1/week @ 2024-08-18 9/week @ 2024-08-25 179/week @ 2024-09-01 4/week @ 2024-09-08 189/week @ 2024-09-15 188/week @ 2024-09-22 43/week @ 2024-09-29 11/week @ 2024-10-06 150/week @ 2024-10-13 137/week @ 2024-10-20 17/week @ 2024-10-27

316 downloads per month
Used in 2 crates

MIT license

84KB
1.5K 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

Dependencies

~5–14MB
~178K SLoC