descriptionA simple file encryption tool
ownerm@bitsnbites.eu
last changeSun, 7 Apr 2024 09:54:50 +0000 (7 11:54 +0200)
content tags
add:
README.md

ezcrypt

A tool for strong encryption of arbitrary files.

Principles

ezcrypt file format

Encryption is done in four layers. At each level a different cipher is used, and each level has its own encyrption key and its own initialization vector (IV). The different ciphers are:

  1. AES, CBC, 256-bit key (outermost level)
  2. ChaCha, 20 rounds, 256-bit key
  3. Twofish, CBC, 256-bit key
  4. Serpent, CBC, 256-bit key (innermost level)

The key at each level is generated from a combination of the user supplied passphrase and a per-level 256-bit salt. This is done using a custom compute intensive key derivation function called ZKDF.

The salt and the IV for each encryption level is generated from system level entropy (i.e. highly random data), and is different for each run of ezcrypt. Thus encrypting the same file twice will result in two different ciphertexts (even if the same passphrase is used).

Note that the encrypted file does not contain any header or other identification metadata. This is by design.

Features

Easy to use

Resistant against cryptanalytic attacks

Free, open source and public domain

All code is free and unencumbered software released into the public domain, including the cryptographic algorithms.

For more information, see unlicense.org.

Building

mkdir out && cd out
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ../src
ninja

The resulting executable file is out/ezcrypt.

Testing

To run the unit tests:

CTEST_OUTPUT_ON_FAILURE=ON ninja test

Installing

After building:

sudo ninja install

Example usage

Encrypt a file

Encrypt the file myfile, with the passphrase provided via a terminal prompt. The output file is called myfile.z (the original file is kept):

$ ezcrypt myfile
Enter passphrase:
Again:

Decrypt a file

Decrypt the file myfile.z, with the passphrase provided via a terminal prompt. The output file is called myfile (the original file is kept):

$ ezcrypt -d myfile.z
Enter passphrase:

Decrypt and print a file

Decrypt the file myfile.z to stdout, with the passphrase provided via the environment variable $SECRET:

$ ezcrypt --show -E SECRET myfile.z

Encrypt & decrypt via pipes

$ echo "Hello world!" | ezcrypt -E SECRET | ezcrypt -d -E SECRET
Hello world!

Edit an encrypted text file

Edit the plaintext contents of the encrypted file myfile.z, using the default text editor (e.g. $EDITOR or notepad.exe):

$ ezcrypt --edit myfile.z

Note: If the plaintext is not modified by the editor, myfile.z remains unmodified. This is useful if you accidentally use the wrong passphrase (you will notice right away since the plaintext will appear as garbage), in which case you can juse exit the editor.

shortlog
2024-04-07 mBump version to 0.18.6masterv0.18.6
2024-04-07 mCMake: Fix compiler errors on Raspbian 10 (buster)
2024-01-18 mUse pointers to const in more places
2024-01-18 maes.c: Improve test code coverage
2024-01-18 mstringutils.c: Improve test code coverage
2023-02-25 mBump version to 0.18.5v0.18.5
2023-02-25 mezcrypt.c: Add signal handlers for CTRL+C and kill
2023-02-23 mfileutils.c: Set private security attributes (WIN32)
2023-02-23 mMSVC: Fix compiler warnings
2023-02-23 mBump version to 0.18.4v0.18.4
2023-02-23 marguments.c: Add some more help text
2023-02-22 mezcrypt.c: Allow editor command to include arguments
2023-02-21 mBump version to 0.18.3v0.18.3
2023-02-22 mpassphrase.c: Use Unicode GetEnvironmentVariableW ...
2023-02-22 mentropy.c: Improve entropy gathering logic
2023-02-21 mcoverage.sh: Clean up old coverage files before running...
...
tags
2 weeks ago v0.18.6
14 months ago v0.18.5
14 months ago v0.18.4
14 months ago v0.18.3
14 months ago v0.18.2
14 months ago v0.17.0
14 months ago v0.18.1
14 months ago candidate-1
14 months ago v0.18.0
14 months ago v0.16.1
14 months ago v0.16.0
14 months ago v0.15.1
14 months ago v0.15.0
14 months ago v0.14.0
14 months ago v0.13.0
14 months ago v0.12.1
...
heads
2 weeks ago master