Skip to main content

Password manager using steganography to embed encrypted credentials in images

Project description

StegVault

Secure password manager using steganography to embed encrypted credentials within images

Python Version License Tests Coverage

StegVault is a full-featured password manager that combines modern cryptography with steganography. It can store either a single password or an entire vault of credentials, all encrypted using battle-tested algorithms (XChaCha20-Poly1305 + Argon2id) and hidden within ordinary PNG images using LSB steganography.

Latest Features (v0.4.0): Complete password manager with vault import/export, secure clipboard integration, TOTP/2FA authenticator with QR codes, and realistic password strength validation using zxcvbn!

Features

Core Features

  • ๐Ÿ” Strong Encryption: XChaCha20-Poly1305 AEAD with Argon2id KDF
  • ๐Ÿ–ผ๏ธ Invisible Storage: LSB steganography with sequential pixel ordering
  • ๐Ÿ”’ Zero-Knowledge: All operations performed locally, no cloud dependencies
  • โœ… Authenticated: AEAD tag ensures data integrity
  • ๐Ÿงช Well-Tested: 275 unit tests with 80% overall coverage (all passing)
  • โฑ๏ธ User-Friendly: Progress indicators for long operations

Vault Mode

  • ๐Ÿ—„๏ธ Multiple Passwords: Store entire password vault in one image
  • ๐ŸŽฏ Key-Based Access: Retrieve specific passwords by key (e.g., "gmail", "github")
  • ๐Ÿ”‘ Password Generator: Cryptographically secure password generation
  • ๐Ÿ“‹ Rich Metadata: Username, URL, notes, tags, timestamps for each entry
  • ๐Ÿ”„ Dual-Mode: Choose single password OR vault mode
  • โ™ป๏ธ Auto-Detection: Automatically detects format on restore (backward compatible)
  • ๐Ÿ“ค Import/Export: Backup and restore vaults via JSON
  • ๐Ÿ“‹ Clipboard Support: Copy passwords to clipboard with auto-clear
  • ๐Ÿ” TOTP/2FA: Built-in authenticator with QR code support
  • ๐Ÿ›ก๏ธ Password Strength: Realistic validation using zxcvbn with actionable feedback

Quick Start

Installation

# Install from PyPI (recommended)
pip install stegvault

# Or install from source
git clone https://github.com/kalashnikxvxiii-collab/stegvault.git
cd stegvault
pip install -e .

Usage

Mode 1: Single Password (Simple Backup)

1. Check Image Capacity

stegvault check -i myimage.png

2. Create Backup

stegvault backup -i cover.png -o backup.png

3. Restore Password

stegvault restore backup.png

Mode 2: Vault (Multiple Passwords) - NEW!

1. Create Vault with First Entry

stegvault vault create -i cover.png -o vault.png -k gmail --generate
# Automatically generates a secure password for Gmail

2. Add More Passwords

stegvault vault add vault.png -o vault_v2.png -k github -u myusername --generate
stegvault vault add vault_v2.png -o vault_v3.png -k aws

3. Retrieve Specific Password

stegvault vault get vault_v3.png -k gmail
# Output:
# Entry: gmail
# Username: user@gmail.com
# URL: https://gmail.com
# Password: X7k$mP2!qL5@wN

4. List All Keys

stegvault vault list vault_v3.png
# Output:
# Vault contains 3 entries:
#   1. gmail (user@gmail.com)
#   2. github (myusername)
#   3. aws

5. Update Entry

stegvault vault update vault_v3.png -o vault_v4.png -k gmail --password newpass123

6. Export Vault

stegvault vault export vault_v4.png -o backup.json --pretty

7. Import Vault

stegvault vault import backup.json -i cover.png -o restored_vault.png

8. Delete Entry

stegvault vault delete vault_v4.png -o vault_v5.png -k oldservice

9. Copy Password to Clipboard

stegvault vault get vault.png -k gmail --clipboard
# Password copied to clipboard (not displayed on screen)

# Auto-clear clipboard after 30 seconds
stegvault vault get vault.png -k gmail --clipboard --clipboard-timeout 30

10. Setup TOTP/2FA

# Add TOTP secret to entry
stegvault vault add vault.png -o vault_v2.png -k github -u myuser --totp

# Generate TOTP code
stegvault vault totp vault_v2.png -k github
# Output: Current TOTP code for 'github': 123456 (valid for 25 seconds)

# Show QR code for authenticator app
stegvault vault totp vault_v2.png -k github --qr

How It Works

Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    StegVault Workflow                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

        BACKUP CREATION                 PASSWORD RECOVERY
               โ†“                                โ†“
    1. User Input                    1. Load Stego Image
       โ€ข Master Password                 โ€ข backup.png
       โ€ข Passphrase                      โ€ข Enter Passphrase
       โ€ข Cover Image
                                      2. Extract Payload
    2. Encryption                        โ€ข LSB Extraction
       โ€ข Generate Salt (16B)             โ€ข Sequential Order
       โ€ข Derive Key (Argon2id)           โ€ข Parse Binary Format
       โ€ข Encrypt (XChaCha20)
                                      3. Decryption
    3. Payload Format                    โ€ข Verify AEAD Tag
       โ€ข Magic: "SPW1"                   โ€ข Derive Key (Argon2id)
       โ€ข Salt + Nonce                    โ€ข Decrypt Ciphertext
       โ€ข Ciphertext + Tag
                                      4. Recover Password
    4. LSB Embedding                     โ€ข Display/Save Password
       โ€ข Sequential Pixels
       โ€ข Modify LSB of R,G,B
       โ€ข Save Stego Image

    5. Output: backup.png

Cryptographic Stack

Component Algorithm Parameters
AEAD Cipher XChaCha20-Poly1305 256-bit key, 192-bit nonce
KDF Argon2id 3 iterations, 64MB memory, 4 threads
Salt CSPRNG 128 bits (16 bytes)
Nonce CSPRNG 192 bits (24 bytes)
Tag Poly1305 128 bits (16 bytes)

Payload Format

Binary structure embedded in images:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Offset  โ”‚  Size  โ”‚  Field         โ”‚  Description  โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  0       โ”‚  4B    โ”‚  Magic Header  โ”‚  "SPW1"       โ”‚
โ”‚  4       โ”‚  16B   โ”‚  Salt          โ”‚  For Argon2id โ”‚
โ”‚  20      โ”‚  24B   โ”‚  Nonce         โ”‚  For XChaCha20โ”‚
โ”‚  44      โ”‚  4B    โ”‚  CT Length     โ”‚  Big-endian   โ”‚
โ”‚  48      โ”‚  N     โ”‚  Ciphertext    โ”‚  Variable     โ”‚
โ”‚  48+N    โ”‚  16B   โ”‚  AEAD Tag      โ”‚  (appended)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Steganography Technique

LSB (Least Significant Bit) Embedding:

  1. Sequential Pixel Ordering: All payload bits stored left-to-right, top-to-bottom for reliability and simplicity
  2. Distributed Embedding: Payload bits spread across R, G, B channels
  3. Minimal Visual Impact: Only LSB modified (imperceptible to human eye)
  4. Security Philosophy: Cryptographic strength (XChaCha20-Poly1305 + Argon2id) provides security, not pixel ordering
# Simplified example
for y in range(height):
    for x in range(width):
        for channel in [R, G, B]:
            channel_value = (channel_value & 0xFE) | payload_bit

Security Considerations

โœ… Strong Security Features

  • Modern Cryptography: XChaCha20-Poly1305 is a modern AEAD cipher resistant to various attacks
  • Strong KDF: Argon2id winner of Password Hashing Competition, resistant to GPU/ASIC attacks
  • Authenticated Encryption: Poly1305 MAC ensures integrity; tampering detected automatically
  • Cryptographic Security: Security provided by strong cryptography, not by hiding embedding pattern
  • No Key Reuse: Fresh nonce generated for each encryption

โš ๏ธ Limitations & Warnings

  • Not Invisible: Advanced steganalysis may detect embedded data
  • No Deniability: Payload has identifiable magic header
  • JPEG Lossy: Recompressing JPEG images destroys payload (use PNG)
  • Both Required: Losing either image OR passphrase = permanent data loss
  • Offline Attacks: Attacker with image can attempt brute-force (mitigated by Argon2id)

๐Ÿ”’ Best Practices

  1. Strong Passphrase: Use 16+ character passphrase with mixed case, numbers, symbols
  2. Multiple Backups: Store copies in different locations
  3. PNG Format: Always use PNG (lossless) not JPEG (lossy)
  4. Verify Backups: Test restore process after creating backup
  5. Secure Storage: Protect image files as you would protect passwords

Development

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=stegvault --cov-report=html

# Run specific module tests
pytest tests/unit/test_crypto.py -v

Code Quality

# Format code
black stegvault tests

# Type checking
mypy stegvault

Project Structure

stegvault/
โ”œโ”€โ”€ stegvault/           # Source code
โ”‚   โ”œโ”€โ”€ crypto/          # Cryptography (Argon2id + XChaCha20)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ core.py
โ”‚   โ”œโ”€โ”€ stego/           # Steganography (PNG LSB)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ png_lsb.py
โ”‚   โ”œโ”€โ”€ utils/           # Payload format handling
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ payload.py
โ”‚   โ”‚   โ””โ”€โ”€ config.py
โ”‚   โ”œโ”€โ”€ vault/           # Password vault management (NEW in v0.4.0)
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ core.py       # Vault and VaultEntry classes
โ”‚   โ”‚   โ”œโ”€โ”€ operations.py # Vault CRUD operations + import
โ”‚   โ”‚   โ”œโ”€โ”€ generator.py  # Password generator
โ”‚   โ”‚   โ””โ”€โ”€ totp.py       # TOTP/2FA support
โ”‚   โ”œโ”€โ”€ batch/           # Batch operations
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ””โ”€โ”€ processor.py
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ cli.py           # Command-line interface
โ”œโ”€โ”€ tests/               # Test suite (275 tests, 80% coverage)
โ”‚   โ”œโ”€โ”€ unit/
โ”‚   โ”‚   โ”œโ”€โ”€ test_crypto.py              # 26 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_payload.py             # 22 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_stego.py               # 16 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_config.py              # 28 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_batch.py               # 20 tests
โ”‚   โ”‚   โ”œโ”€โ”€ test_vault.py               # 49 tests (vault module)
โ”‚   โ”‚   โ”œโ”€โ”€ test_cli.py                 # 53 tests (core CLI)
โ”‚   โ”‚   โ”œโ”€โ”€ test_vault_cli.py           # 38 tests (vault CLI)
โ”‚   โ”‚   โ”œโ”€โ”€ test_totp.py                # 19 tests (TOTP/2FA)
โ”‚   โ”‚   โ””โ”€โ”€ test_password_strength.py   # 24 tests (password validation)
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ docs/                # Documentation
โ”œโ”€โ”€ examples/            # Example images
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ CONTRIBUTING.md
โ”œโ”€โ”€ LICENSE              # MIT License
โ”œโ”€โ”€ README.md            # This file
โ”œโ”€โ”€ ROADMAP.md
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ requirements.txt

Roadmap

See ROADMAP.md for planned features and development timeline.

Coming Soon

  • GUI application (Electron or Qt)
  • JPEG DCT steganography (more robust)
  • Multi-vault operations and search
  • Gallery foundation for multi-file vault management
  • Optional cloud storage integration

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for guidelines.

Quick Contribution Guide

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Make changes with tests
  4. Commit (git commit -m 'feat: add amazing feature')
  5. Push (git push origin feature/amazing-feature)
  6. Open Pull Request

License

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

Disclaimer

StegVault is provided "as-is" for educational and personal use. The authors are not responsible for any data loss or security breaches. Always maintain multiple backups of critical passwords.

Security Notice: While StegVault uses strong cryptography, no system is perfect. This tool is best used as a supplementary backup method alongside traditional password managers.

Acknowledgments

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

stegvault-0.4.0.tar.gz (40.8 kB view details)

Uploaded Source

Built Distribution

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

stegvault-0.4.0-py3-none-any.whl (41.2 kB view details)

Uploaded Python 3

File details

Details for the file stegvault-0.4.0.tar.gz.

File metadata

  • Download URL: stegvault-0.4.0.tar.gz
  • Upload date:
  • Size: 40.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stegvault-0.4.0.tar.gz
Algorithm Hash digest
SHA256 fe597e8afd810454912987b2e71fae0a8a0f0b8d3c793e1fddf7e86cc52b3b35
MD5 4ad7864c26adcf8f890d5e541ec0f7ae
BLAKE2b-256 e942f1c97b032e68404819fc781fb1e2889056ef0d3cf78d66c8c3d30bd18ab7

See more details on using hashes here.

File details

Details for the file stegvault-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: stegvault-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 41.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stegvault-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bbe01fa16eb8a8d9bcf6e73c4a433b4fa0a5563b75067b45a56afd44620d956
MD5 ff59000cb771c5cb1fd44a1caf4e6a1a
BLAKE2b-256 95ecc950f8b84099fbcb0f187a642fac6ba022256d386b97084744a7a345f9e8

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