| Crates.io | ecrypt |
| lib.rs | ecrypt |
| version | 0.1.2 |
| created_at | 2023-01-23 20:58:03.255983+00 |
| updated_at | 2023-01-23 20:58:03.255983+00 |
| description | CLI tool to easily encrypt and decrypt files or directories |
| homepage | https://github.com/tirax-lab/ecrypt |
| repository | https://github.com/tirax-lab/ecrypt |
| max_upload_size | |
| id | 766202 |
| size | 44,126 |
CLI tool to easily encrypt and decrypt files or directories.
The encryption/decryption process and the source code is transparent and easily understandable, see the Under the Hood section.
The simplest way is: cargo install ecrypt
To build from source, you can clone the repo and build the release binary:
git clone https://github.com/tirax-lab/ecrypt
cd ecrypt
cargo build --release
sudo mv target/release/ecrypt /usr/local/bin
Use --help after any subcommand(e.g. enc for encrypt and dec for decrypt) to view all options. For example directory encryption supports the -c/--compress flag for tar gunzip compression.
$ ecrypt enc README.md
Encryption password:
[2023-01-23T20:37:31Z INFO ecrypt::enc] Writing encrypted data of file "README.md" to "README.md.encrypted"
[2023-01-23T20:37:31Z WARN ecrypt::enc] The unencrypted file 'README.md' remains on disk, you can remove it manually or run ecrypt with the --remove/-r flag
A file README.md.encrypted will have been created with the encrypted contents.
$ ecrypt dec README.md.encrypted
Decryption password:
[2023-01-23T20:39:11Z INFO ecrypt::dec] Writing decrypted data of file "README.md.encrypted" to "README.md.decrypted"
A file README.md.decrypted will have been created with the decrypted contents.
$ ecrypt dec directory.encrypted_dir
Decryption password:
[2023-01-23T20:41:33Z INFO ecrypt::dec] Writing decrypted data of file "directory.encrypted_dir" to "directory.decrypted"
[2023-01-23T20:41:33Z INFO ecrypt::dec] Unpacking tarball of decrypted directory: 'directory.decrypted'
This will create 2 outputs: a directory.decrypted file which is the decrypted tarball, which has been unpacked to produce the directory
This section documents how ecrypt handles file/directory encryption and decryption so you can evaluate if it is suitable for your security needs. For background see the article on Rust file encryption by Sylvian Kerkour, the author of Black Hat Rust:
-p flag or to the password promptargon, with a salt being producedchacha20poly1305 stream encryptor with the generated nonce.encrypted suffixchacha20poly1305 stream encryptor encrypts and writes chunks of bytes to the output file until the entire source file has been readfile.encrypted which has salt and a nonce at the beginning of the file and encrypted data after that.encrypted suffix but this is not required-p/--password flag or to the password promptchacha20poly1305 stream decryptor and the same nonce has been read from the file. If an incorrect password is provided this hash will be different and the decryption will fail.chacha20poly1305 stream decryptor decrypts and writes chunks of bytes to the output file, which will have a .decrypted suffix, until the entire source file has been readfile.decrypted which contains the plaintext-c/--compress flagdirectory.encrypted-r/--remove to automatically delete the original non-tarball directory toodirectory.decrypted(decrypted tarball) and directory(unencrypted directory) being produced