Skip to main content

basic cli tool for file encryption

Project description

not-enough-secrets

A small command line tool for file encryption. It keeps a simple job simple: pick a file, get an encrypted file back.

The tool is built around pluggable modules, so the actual crypto is swappable and versioned, while the interface stays the same. If a software component is not installed, modules report themselves as unavailable instead of breaking.

Quick example

# encrypt a file, result goes to stdout by default
not-enough-secrets encrypt secret.txt -o secret.txt.nes

# decrypt it again
not-enough-secrets decrypt secret.txt.nes -o secret.txt

# encrypt in place, with a backup safety net and print output to stdout
not-enough-secrets encrypt --stdout --in-place secret.txt

You get prompted for the key on stdin.

Install

From the Python Package Index:

pip install not-enough-secrets

or install with extra cryptography (enabling, for example, AES-GCM)

pip install not-enough-secrets[cryptography]

Use the file completions.bash to set up autocomplete in bash shells.

From a Debian package: Download a release package and enter

dpkg -i not-enough-secrets_<version>.deb

Usage

The tool has four commands: version, modules, encrypt and decrypt.

List modules:

# only modules that are available on your system
not-enough-secrets modules
# also show modules you cannot use, but with their requirements
not-enough-secrets modules --all

Encrypt and decrypt share the same output options:

  • default writes the result to stdout
  • -o, --output PATH writes to a file, add -f, --force to overwrite an existing one
  • --in-place replaces the input file, and only does so once the new content is safely written
  • --stdout can be added alongside -o or --in-place to also print the result

Pick a module with -m. The value is the module identifier, optionally followed by options after a colon (options are module specific):

not-enough-secrets encrypt notes.txt -m aes-gcm-0:128 -o notes.nes

Leave -m off and encrypt picks a sane default for your system. Decrypt reads the module and its settings from the file header, so you normally only need to supply the key. You can still pass -m on decrypt to force a specific module if you know what you are doing.

Add -v for info logging or --debug for debug logging and full tracebacks (logs to stderr).

Modules

  • aes-gcm-0 AES-GCM with a PBKDF2-HMAC-SHA256 derived key. Optional key size of 128, 192 or 256 bits, default 256. Needs the cryptography package.
  • fernet-0 Fernet authenticated encryption with a PBKDF2-HMAC-SHA256 derived key. No options. Needs the cryptography package.
  • base64 Base64 obfuscation. This is not encryption and provides no security at all. It exists for tests and debugging, do not use it for real data.

Each module carries its own version in its identifier. Older files keep working because the matching module version stays around to read them.

Build

This project uses Docker to create reproducible builds.

Build the Python distributions with

make up
make build-wheel
make down

Build a DEB-file with

make build-deb

Development

The Makefile defines some helpful targets for local development:

make up
make install
make test
make down

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

not_enough_secrets-0.1.1.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

not_enough_secrets-0.1.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file not_enough_secrets-0.1.1.tar.gz.

File metadata

  • Download URL: not_enough_secrets-0.1.1.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for not_enough_secrets-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f009a28c4a83f4b601d2f91b50670875aecaefedd2c908c7b5a05a086ec8bd35
MD5 21f026b67670a5e34672af0514c91d96
BLAKE2b-256 bb8eff42cc3998dbfaa9c33d830188b07fb3fda70a18686f8817a129cefcfa7d

See more details on using hashes here.

File details

Details for the file not_enough_secrets-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for not_enough_secrets-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0b773eba0cfc137c260c61c7591c2d47c501e7b806fb7de7c8f7e37a5bb97ec
MD5 77da681aabfe4a8d13e293348c224da4
BLAKE2b-256 0a781dda94b01ceeb530cc9e793bd210274c322447bf500c76d018c772be9c69

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page