Skip to main content

Keybox

Introduction

Keybox is a secure store for passwords, keys, and other secrets.

There is a Python API (import keybox), a runnable package (python3 -m keybox) and a wrapper script (keybox, created by setuptools).

Keybox is completely offline. All secrets stay safely in a local file. Nothing is sent anywhere, unless you explicitly set up network synchronization using some other tool.

Features:

  • Data encrypted using strong encryption (PyNaCl)

  • Inside encrypted envelope, it’s a simple tab-delimited file format

  • Shell-like text user interface

Security:

  • Master password is saved in memory for as long as the program runs.

  • Neither the password nor decrypted data are written to the disk (unless explicitly exported).

Portability:

  • The script should run on any system with Python3 installed (including Windows).

  • Requires no installation. You can bring your keybox with you anywhere.

  • Can be contained in a single Python file (see Static Distribution below)

Dependencies:

  • Python 3.7 or later

  • PyNaCl, prompt_toolkit, blessed, pyperclip

Installation

Install Python package, together with the keybox wrapper script, from PyPI:

pip3 install keybox

That’s it. PIP should pull in the required dependencies.

From source / Git repo

Alternatively, install from source:

python3 setup.py install

The package can also run without installation, directly from source tree root:

python3 -m keybox

Dependencies

  • pynacl - the encryption

  • argon2-cffi - optional, replaces argon2 from PyNaCl when available

  • prompt_toolkit, blessed, pyperclip - command-line and shell

  • /usr/share/dict/words

    • used for password generator

    • Debian: apt install wamerican

    • when not available, a replacement words file is downloaded from Internet (This is the only option on Windows)

  • pytest, coverage - for tests

Getting Started

Run the program, choose a master password. A new keybox file will be created.

You are now in the shell. The basic workflow uses the following commands:

  • add some passwords

  • list the records

  • select a record

  • print the password

  • quit

Type help for a list of all commands, help <cmd> for description of each command and its parameters.

Config file

The default config file path is ~/.keybox/keybox.conf. It can be used to point to a different location for the keybox file:

[keybox]
path = ~/vcs/keybox/keybox.safe

Without the config file, the default keybox path is ~/.keybox/keybox.safe.

Password Generator

A bundled password generator can be called from command line (keybox pwgen) or internally from the shell. In the shell, use <tab> when asked for a password (in the add/modify commands) to generate some random passwords.

Pwgen is based on the system word list that is usually found in /usr/share/dict/words. By default, it generates a password from two concatenated words, altered by adding two uppercase letters and one digit somewhere inside the password.

This gives around 50 bits of entropy on my system (Password strength).

Static Distribution

Call make zipapp to create a zipapp file containing all sources. The zipapp file is written to build directory and is directly executable by Python.

The Makefile target uses zipapp module which is available since Python 3.5.

Development

Build docs:

make -C docs html

Run tests:

make test

Show test code coverage:

make htmlcov

Build and check package:

make build
make check

The Project Name

There might be some confusion between this Keybox project and GnuPG project, which has something called “a keybox file (.kbx)” and a tool to handle it, kbxutil.

This Keybox is completely unrelated to the GnuPG one.

Metadata

Release files for keybox 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for keybox 0.5.0
File Size Uploaded
keybox-0.5.0.tar.gz 57.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for keybox 0.5.0
File Interpreter ABI Platform
keybox-0.5.0-cp310-cp310-macosx_11_0_x86_64.whl CPython 3.10 CPython 3.10 macOS 11.0+ x86-64 Details

Total release size: 108.2 kB

Release files / keybox-0.5.0.tar.gz

Download URL keybox-0.5.0.tar.gz
Size 57.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bd85966971274437ee73b6a6cf50df06314d03fb430aff5e2e2b603b0304e09b
BLAKE2b-256 checksum
How to use checksums
2d78851cd2cb49330b0fc817fc992261e391464e6d08d38f28261ce9175ac6fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.8

Release files / keybox-0.5.0-cp310-cp310-macosx_11_0_x86_64.whl

Download URL keybox-0.5.0-cp310-cp310-macosx_11_0_x86_64.whl
Size 50.5 kB
Tags CPython 3.10 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
f70f897b62cfb2b188d19eaf51237dad269042d09d89ed7acec92cd262e880b7
BLAKE2b-256 checksum
How to use checksums
b9123ce1d7552ce4bf12c0a465962385ccb459a7a8d570c04640e86e37d4cd1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.8

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.1

1 release file

0.4

2 release files

0.3

2 release files

0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page