Skip to main content

Secure environment variable management - Encrypt and decrypt .env files with AES-256-GCM

Project description

🔐 EnvLock

Secure environment variable management for teams

EnvLock is a command-line tool that encrypts and decrypts .env files using military-grade AES-256-GCM encryption. Share encrypted environment files safely with your team through version control without exposing sensitive credentials.

PyPI version Python License: MIT

🚀 Quick Start

Installation

pip install envlock-kb

Basic Usage

# Initialize envlock in your project
envlock init

# Encrypt your .env file
envlock encrypt

# Decrypt the .env.enc file
envlock decrypt

# Check version
envlock version

✨ Features

  • 🔒 AES-256-GCM Encryption - Military-grade authenticated encryption
  • 🔑 Password-Based Security - Uses scrypt key derivation (NIST recommended)
  • 📁 Auto .gitignore Setup - Automatically configures git to ignore sensitive files
  • 🎯 Multiple Environment Support - Handle dev, staging, production environments
  • 🛡️ Secure Permissions - Creates files with restricted permissions (0o600)
  • Tamper Detection - Authentication tags detect any file modifications
  • 🚫 Zero Dependencies - Only requires cryptography library

📖 How It Works

  1. Initialize (envlock init): Sets up .gitignore and creates your first encrypted .env.enc file
  2. Encrypt (envlock encrypt): Converts .env.env.enc with password protection
  3. Decrypt (envlock decrypt): Recovers .env from .env.enc using your password

The encrypted files (.env.enc*) can be safely committed to version control.
⚠️ Never commit unencrypted .env files!

🔐 Security

EnvLock implements industry-standard security practices:

  • AES-256-GCM: Authenticated encryption with associated data (AEAD)
  • Scrypt KDF: Password-based key derivation (N=2^14, r=8, p=1)
  • Random Salt & IV: Unique values for each encryption operation
  • Authentication Tags: Cryptographic verification to detect tampering
  • Secure File Permissions: Restricts file access to owner only (Unix mode 600)

💡 Use Cases

  • Team Collaboration: Share encrypted configs safely via Git
  • CI/CD Pipelines: Store encrypted secrets in repositories
  • Multi-Environment: Manage dev, staging, prod credentials separately
  • Backup & Recovery: Securely backup environment configurations

📋 Requirements

  • Python >= 3.8
  • cryptography >= 41.0.0

📝 Example Workflow

# 1. Create your environment variables
echo "DATABASE_URL=postgresql://localhost/mydb" > .env
echo "API_KEY=secret123" >> .env

# 2. Encrypt the file
envlock encrypt
# Enter password: ****

# 3. Commit the encrypted file
git add .env.enc
git commit -m "Add encrypted environment variables"

# 4. Team members can decrypt
envlock decrypt
# Enter password: ****

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Links

⚠️ Security Notice

  • Always use strong, unique passwords for encryption
  • Store your password securely (password manager recommended)
  • Never commit unencrypted .env files to version control
  • Regularly rotate sensitive credentials

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envlock_kb-0.1.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envlock_kb-0.1.0-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file envlock_kb-0.1.0.tar.gz.

File metadata

  • Download URL: envlock_kb-0.1.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for envlock_kb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1228da2716677a99592ad3ca39012e6564ad7cb858e9195cd97b0c7e055370ff
MD5 c0822688dcf06ed6a14f1eac6f086798
BLAKE2b-256 f4f3fb9056b2fe1ae39cbf70f613533b606de22ca1e2fbc8f470a3bd8b98e41e

See more details on using hashes here.

File details

Details for the file envlock_kb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: envlock_kb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for envlock_kb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 733b2d5916d955e728bd2cd0063a96c0bc983608546402e60a184cd0f8ea337c
MD5 c0d42be39b2f3dbcffe76d968f2f1cb9
BLAKE2b-256 e44a793f211216c37a33587024db3245b17a83b44280b8495b19905924875547

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page