AES-256-GCM + RSA-2048 + SHA Hashing + Digital Signatures
Python CLI + Offline Browser UI - No server. No cloud. Pure cryptography.
VaultCipher is a comprehensive cryptographic toolkit that lets you encrypt, decrypt, hash, sign, and verify using battle-tested algorithms:
- AES-256-GCM - Symmetric authenticated encryption used by governments and banks
- RSA-2048/4096 - Asymmetric encryption behind HTTPS, SSH, and secure communications
- RSA-PSS - Digital signatures for message authentication and non-repudiation
- SHA-256/384/512 - Cryptographic hashing for integrity verification
- Password Strength Analysis - Entropy-based password scoring with pattern detection
- IoT Device Authentication - Registers unique device IDs with RSA keys and cryptographically gates decrypted payloads to target devices
- IoT Sensor Integrity Chain - Chronological, tamper-evident hash-chained sensor logging signed via RSA-PSS to prevent telemetry injection or modification
It comes with two interfaces:
- A Python CLI for terminal-based cryptographic operations
- A fully offline Browser UI - open
index.htmland it just works, no internet required
⚠️ Built for educational purposes. Demonstrates real cryptographic principles used in production systems.
VaultCipher/
├── index.html # Web UI (open in any browser)
├── forge.min.js # Crypto library for browser (offline)
├── vaultcipher_cli.py # Python CLI tool
├── requirements.txt # Python dependencies
├── SECURITY.md # Security policy & best practices
├── keys/ # Generated RSA key pairs (gitignored)
│ ├── private_key.pem
│ └── public_key.pem
└── README.md
- Python 3.8+
- pip
pip install -r requirements.txtEncrypt a message:
python vaultcipher_cli.py aes-encrypt --text "your secret message" --password "yourpassword"Decrypt a message:
python vaultcipher_cli.py aes-decrypt --payload "BASE64_CIPHERTEXT_HERE" --password "yourpassword"Generate a key pair:
python vaultcipher_cli.py rsa-keygen --bits 2048 --output ./keysUse
--bits 4096for extra security (slower generation)
Encrypt with public key:
python vaultcipher_cli.py rsa-encrypt --text "hello" --pubkey ./keys/public_key.pemDecrypt with private key:
python vaultcipher_cli.py rsa-decrypt --payload "BASE64_CIPHERTEXT_HERE" --privkey ./keys/private_key.pemSign a message:
python vaultcipher_cli.py rsa-sign --message "I approve this transaction" --privkey ./keys/private_key.pemVerify a signature:
python vaultcipher_cli.py rsa-verify --message "I approve this transaction" --signature "BASE64_SIG" --pubkey ./keys/public_key.pemDigital signatures prove that a message was created by a known sender and was not altered in transit.
Hash text (SHA-256 by default):
python vaultcipher_cli.py hash-text --text "hello world"Hash with a different algorithm:
python vaultcipher_cli.py hash-text --text "hello world" --algorithm sha512Hash a file (streaming, memory-efficient):
python vaultcipher_cli.py hash-file --file ./README.md --algorithm sha256Supported algorithms:
sha256,sha384,sha512,md5
python vaultcipher_cli.py password-strength --password "MyS3cur3P@ssw0rd!"Output includes:
- Score (0-100) with visual bar
- Rating (CRITICAL / WEAK / FAIR / GOOD / STRONG)
- Entropy estimation in bits
- Actionable feedback on how to improve
Secures sensor readings locally using device-linked keypairs, hybrid authenticated encryption, and tamper-evident blockchain-style hash chains.
Register a virtual IoT device (creates a dedicated RSA keypair and local signed JSON certificate in devices/<device_id>/):
python vaultcipher_cli.py device-register --device-id "sensor-42"Encrypt data specifically for sensor-42. Decryption will fail if attempted by any other device ID (enforcing access control):
# Encrypt data locked to a specific device ID
python vaultcipher_cli.py device-encrypt --text "temp=22.5,humidity=60" --device-id "sensor-42"
# Decrypt using the authorized device ID (success case)
python vaultcipher_cli.py device-decrypt --payload "ENCRYPTED_PAYLOAD" --device-id "sensor-42"
# Decrypt using an unauthorized device ID (fails instantly with ACCESS DENIED)
python vaultcipher_cli.py device-decrypt --payload "ENCRYPTED_PAYLOAD" --device-id "hacker-99"Build a sequential, hash-linked cryptographically signed ledger for sensor telemetry. Any alteration to historical blocks instantly breaks the chain verification.
# Initialize the chain (generates Block 0 Genesis)
python vaultcipher_cli.py sensor-init --device-id "sensor-42"
# Push new readings to the chain (automatically signed via RSA-PSS and linked to prev_hash)
python vaultcipher_cli.py sensor-push --device-id "sensor-42" --reading "temp=22.5"
python vaultcipher_cli.py sensor-push --device-id "sensor-42" --reading "temp=22.8"
# Verify chain integrity (verifies all hashes, prev_hash links, indices, and signatures)
python vaultcipher_cli.py sensor-verify --device-id "sensor-42"- Make sure
index.htmlandforge.min.jsare in the same folder - Double-click
index.htmlto open in your browser - No internet connection required - everything runs locally
| Tab | Features |
|---|---|
| AES | Encrypt/decrypt with password + live strength meter |
| RSA | Generate keys, encrypt/decrypt, sign/verify messages |
| HASHING | SHA-256/384/512/SHA-1 digest computation |
| HOW IT WORKS | Cryptographic concepts explained |
AES (Advanced Encryption Standard) in GCM (Galois/Counter Mode) is the gold standard for symmetric encryption. The same key encrypts and decrypts.
| Parameter | Value |
|---|---|
| Key Size | 256 bits |
| Mode | GCM (Authenticated Encryption) |
| KDF | PBKDF2-SHA256 |
| Iterations | 480,000 |
| Salt | 16 bytes (random per operation) |
| Nonce | 12 bytes (random per operation) |
Step-by-step encryption flow:
- Generate a random 16-byte salt
- Derive a 256-bit key from your password using PBKDF2-SHA256 (480k iterations)
- Generate a random 12-byte nonce
- Encrypt the message using AES-GCM -> produces ciphertext + 16-byte auth tag
- Output:
base64(salt + nonce + ciphertext + tag)
Why PBKDF2? Raw passwords are weak keys. PBKDF2 stretches your password into a proper 256-bit key and makes brute-force attacks computationally expensive.
Why GCM? GCM provides authenticated encryption - if anyone tampers with the ciphertext, decryption fails. You get both confidentiality and integrity.
RSA uses a mathematically linked key pair. What the public key encrypts, only the private key can decrypt - and vice versa.
| Parameter | Value |
|---|---|
| Key Sizes | 2048 / 4096 bits |
| Padding | OAEP-SHA256 |
| Public Exponent | 65537 |
| Format | PEM (PKCS#1) |
| Max Message Size | ~190 bytes (2048-bit key) |
The math behind RSA: Security relies on the fact that multiplying two large prime numbers is easy, but factoring the result back into those primes is computationally infeasible at this scale.
Why OAEP? Raw/textbook RSA has known vulnerabilities. OAEP (Optimal Asymmetric Encryption Padding) adds randomness and structure that defeats these attacks.
Real-world pattern (Hybrid Encryption): RSA alone can only encrypt small payloads. In production systems, AES encrypts the actual data, and RSA encrypts the AES key. This is how HTTPS works.
RSA-PSS (Probabilistic Signature Scheme) provides authentication and non-repudiation:
| Parameter | Value |
|---|---|
| Scheme | PSS (Probabilistic Signature Scheme) |
| Hash | SHA-256 |
| Salt Length | Maximum |
| Use Case | Message authentication, code signing |
How it works:
- Hash the message with SHA-256
- Sign the hash with the private key using PSS padding
- Anyone with the public key can verify the signature
- If the message is altered, verification fails
| Algorithm | Digest Size | Status |
|---|---|---|
| SHA-256 | 256 bits (64 hex chars) | ✅ Recommended |
| SHA-384 | 384 bits (96 hex chars) | ✅ Secure |
| SHA-512 | 512 bits (128 hex chars) | ✅ Secure |
| SHA-1 | 160 bits (40 hex chars) | |
| MD5 | 128 bits (32 hex chars) | ❌ Broken |
Combines asymmetric (RSA-OAEP) and symmetric (AES-GCM) cryptography to lock payloads to a specific device.
- The Identity Gate: The target device ID is packed into a length-prefixed header. Upon reception, the gateway compares this ID to the local device ID. If they mismatch, the process is aborted prior to key decryption.
- Destination Verification: The device ID is also passed as Additional Authenticated Data (AAD) to the AES-GCM engine. This guarantees that an attacker cannot alter the target device ID header field without causing GCM tag validation to fail.
A sequential, tamper-evident ledger for recording sensor readings.
- Sequential Hashing: Each reading block stores the hash of the preceding block (
prev_hash). The hash of the block itself is computed by serializing the JSON keys in alphabetical order, explicitly excluding thehashandsignaturefields to prevent circular dependency errors. - Cryptographic Signatures: The device signs the block hash using its private RSA key via RSA-PSS padding. During verification, the chain validator recomputes all hashes and checks all signatures against the device's public key, instantly flagging any historical modification.
| Concept | Description |
|---|---|
| Salt | Random data added to password before hashing - defeats rainbow table attacks |
| Nonce | Used exactly once per encryption - ensures same message encrypts differently every time |
| PBKDF2 | Deliberately slow key derivation - makes brute-force attacks expensive |
| Authenticated Encryption | GCM's auth tag detects any tampering with ciphertext |
| Public/Private Key Pair | Foundation of all modern secure communication |
| Digital Signatures | RSA-PSS proves message authenticity and detects tampering |
| PEM Format | Standard text format for storing and sharing RSA keys |
| OAEP Padding | Secure padding scheme that hardens RSA against known attacks |
| PSS Padding | Probabilistic signature padding - more secure than PKCS#1 v1.5 |
| Entropy | Measure of randomness/unpredictability in a password or key |
| Tool | Purpose |
|---|---|
cryptography (Python) |
AES-GCM, RSA, PBKDF2, PSS signatures for CLI |
forge.min.js (Browser) |
Full crypto library for offline web UI |
- Never commit your
keys/folder to GitHub - your private key must stay private - RSA is limited to ~190 bytes per encryption with 2048-bit keys - use AES for large data
- This project is for educational use - for production systems, use established libraries and follow security auditing practices
- All cryptographic operations run locally - no data is sent anywhere
- See SECURITY.md for detailed security best practices
Built by H8RSH100 - CS/IT Engineering Student
Part of a cybersecurity portfolio series.
MIT - see LICENSE.