Zymic CLI
Encrypt and decrypt files using the Zymic format.
zymic is a command-line tool for encrypting data with a
password-protected key file. Each stream is encrypted with a unique
one-time key, and decryption verifies integrity to detect any
tampering, truncation, or reordering.
zymic functions as a stream filter: it can operate on individual
files or through stdin/stdout. To encrypt a directory or multiple
files, first package them into a single archive (e.g., tar, zip).
Install
From Source (Linux/macOS/Windows)
-
Install the
zymiccli:
Cargo places binaries in your user bin dir:
-
Linux/macOS:
~/.cargo/bin(add toPATHif needed) -
Windows:
%USERPROFILE%\.cargo\bin(rustup usually adds this automatically)
From Tarball (Linux)
-
Obtain the tarball and
SHA256SUM.txtfiles from the GitHub release page. -
Extract files.
- (Optional) Verify SHA256 checksums.
- Run the install script.
The default destination of the installation (/usr/local) may be
overriden by setting the PREFIX environment variable.
PREFIX="/.local"
Quick start
# Create a key (prompts for a new password)
# Encrypt a file
# Decrypt a file
Usage
Usage: zymic <COMMAND>
Commands:
dec Decrypt data
enc Encrypt data
key Key file sub-commands
help Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
Subcommands
enc
Encrypt data.
Usage: zymic enc [OPTIONS] [FILE]
Arguments:
[FILE] File to encrypt, or '-' to encrypt from stdin (defaults to stdin)
Options:
-o, --output <OUTPUT> Output file, or '-' to write to stdout
-k, --key <KEY> Key file path
-f, --force Overwrite files without any check
-h, --help Print help
Default output is FILE + ".zym" (e.g., foo.txt → foo.txt.zym)
dec
Decrypt data.
Usage: zymic dec [OPTIONS] [FILE]
Arguments:
[FILE] File to decrypt, or '-' to decrypt from stdin (defaults to stdin)
Options:
-o, --output <OUTPUT> Output file, or '-' to write to stdout
-k, --key <KEY> Key file path
-f, --force Overwrite files without any check
-h, --help Print help
Default output strips the .zym extension from the FILE (e.g.,
foo.txt.zym → foo.txt).
key new
Create a new key file.
Usage: zymic key new [OPTIONS]
Options:
-k, --key <KEY>
new key file path (defaults to ${HOME}/.zymic/zymic_key.json)
-a, --argon-config <ARGON_CONFIG>
Argon2 hash parameter setting. This argument tunes the
resources required to compute the Argon2 hash from the
user-provided password. It's a proof of work step to
limit the ability of an attacker to mine the user's
key password.
[default: cpu]
Possible values:
- cpu: CPU intensive Argon2 configuration.
- mem: Memory intensive Argon2 configuration.
- min: This setting uses the least amount of resources.
It is the least secure but most performant setting.
This should only be used for testing purposes.
-h, --help
Print help (see a summary with '-h')
key info
Display key file metadata information
Usage: zymic key info [OPTIONS]
Options:
-k, --key <KEY> Key file path (defaults to ${HOME}/.zymic/zymic_key.json)
-c, --check Perform an authentication check. (password required)
-h, --help Print help
key password
Change password for a key file.
Usage: zymic key password [OPTIONS]
Options:
-k, --key <KEY> Key file path (defaults to ${HOME}/.zymic/zymic_key.json)
-h, --help Print help
Environment Variables
ZYMIC_DIR overrides the default configuration directory used to
locate the key file. If unset, the default is $HOME/.zymic (on
Linux/macOS) or %USERPROFILE%\.zymic (on Windows).
Exit Status
-
0: Success.
-
non-zero: An error occurred (invalid arguments, I/O error, integrity check failed, bad password, etc.)
Files
-
Default key path:
$ZYMIC_DIR/zymic_key.json -
Default config directory if ZYMIC_DIR is not set:
$HOME/.zymic
Key File
zymic uses a password-protected key file to encrypt and decrypt
data. The key file contains a Parent Key, from which a unique,
one-time Data Key is derived for each stream. The Data Key is then
used to encrypt the input file.
The key file is required for decryption. If the key file is lost, any data encrypted with it is permanently unrecoverable.
Examples
# Encrypt a file to the default output (adds ".zym"):
# Decrypt a file to the default output (strips ".zym"):
# Encrypt with explicit output:
# Stream from stdin to a file:
|
# Stream from a file to stdout:
|
License
All code and documentation in this repository is licensed under the MIT License.
You are free to use, modify, and distribute this project in accordance with the terms of that license.