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.0.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.0-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: not_enough_secrets-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 f12a36195a812a1e473a5cab2743c7ac80ab22fd0c42d97e57f3d85a2e328d0f
MD5 ecb1f954475afcd796bd25ef59795253
BLAKE2b-256 df3c578e9d4b89436b26b3660ed8dfdeb47b83b6f4cbbaf96b147bbff0a8e03e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for not_enough_secrets-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f513b552a12799efa0aa8e64c2d2c18767ccdb439d132dd4ba9b7d8be0762891
MD5 5c01a564ec0ac691cf593f936d03bf1b
BLAKE2b-256 e53c7306685f923f0ab96a3e4b354c21ed651040161029b37e011074c1463b73

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