- Rust 94.8%
- Python 4.2%
- Shell 1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| end_to_end_test.py | ||
| env.test | ||
| LICENSE | ||
| README.md | ||
| test_decrypt.sh | ||
| test_encrypt.sh | ||
cryptenv
This is a CLI utility to encrypt and decrypt your .env files so they can be safely committed to VCS repos. It tries to Keep It Simple and adheres to the Unix philosophy: Do one thing, and do it well.
I am a beginner with Rust and still learning. 🦀
In particular:
- Do not rely on this to keep your AWS secrets safe in a public GitHub repository
- better: do not use this in production at all
I did not write the actual encryption algorithms used, but there might be fuckups in library usage.
Features
- encrypt .env files
- decrypt .env files
- generate AES keys for later use
Non-Features
- not a full fledged high-level encryption tool
- no runtime encryption/decryption on the fly (so decrypted values are visible to anyone on your server)
Usage
Generate an AES key:
cryptenv generate
Uses stdout, so standard Unix CLI is available:
cryptenv generate > key.txt
Encrypt an .env file:
cryptenv encrypt --source-file=env.test --target-file=env.crypt
Encrypt an .env file in-place:
cryptenv encrypt --source-file=env.test # omit target file
Decrypt commands work exactly the same.
All commands expect the MASTER_KEY environment variable to be set to a valid base64-encoded AES key as generated by the generate subcommand.
If none is set, you are prompted to provide one.
Crates used
base64for enconding/decoding byte valuesaes-gcmfor the actual encryptionclapfor the CLI parsing functionality
=> this is basically all glue code that a LLM could garble out in 5 minutes. I chose not to use one though.
Library Features
In theory, you could use this as a high level layer on top of aes-gcm to encrypt arbitrary strings, but you're probably better off using the mentioned crates directly.
License
Licensed under AGPL-3.
Contributing
Nobody does that these days, who are you kidding?