A secure hybrid file encryption system built in Python using AES-256-GCM and RSA-2048 OAEP, featuring a full desktop GUI, integrity verification, secure deletion, and RAM-only decryption.
PrivaCrypt is a desktop-based encryption system designed to securely encrypt and decrypt files using a hybrid cryptographic model. It combines:
- AES-256-GCM for fast symmetric encryption of file data
- RSA-2048 OAEP for secure key exchange
- SHA-256 for integrity verification
The application is built with a modular architecture separating cryptographic logic (backend) from the graphical interface (Tkinter frontend).
- Encrypt any file format using AES-256-GCM
- Secure AES key wrapping using RSA-2048 OAEP
- Decrypt
.vaultfiles with password-protected private keys
- Encrypt multiple files or entire directories
- Recursive folder support with configurable depth
- Progress tracking with real-time logs
- Decrypt files directly into memory
- Prevents plaintext from being written to disk
- Secure buffer discard after use
- SHA-256 hash validation
- AES-GCM authentication tag verification
- Detects any tampering or corruption
- 3-pass overwrite mechanism using random data
- Reduces forensic recovery risk (HDD optimized)
- Tracks all operations (encrypt, decrypt, delete, verify)
- Stored in structured JSON logs
- RSA-2048 key pair generation
- Private key encrypted with AES-256-CBC password protection
- Enforces 365-day key rotation policy (NIST SP 800-57 aligned)
Handles all cryptographic operations:
- AES / RSA encryption & decryption
- Key generation and storage
- File parsing and
.vaultconstruction - Integrity verification
- Secure deletion logic
Provides user interaction layer:
- Multi-tab interface (Lock, Unlock, Batch, Integrity, Keys)
- Drag-and-drop file support
- Progress bars and live logs
- Password-protected dialogs
- Generate random 256-bit AES session key
- Encrypt file using AES-256-GCM
- Encrypt AES key using RSA-2048 OAEP
- Store all components inside
.vaultfile
- Mode: Authenticated Encryption (AEAD)
- 12-byte nonce per file
- 16-byte authentication tag
- Ensures confidentiality + integrity
- Public-key encryption for AES key wrapping
- OAEP padding with SHA-256
- Resistant to chosen ciphertext attacks
- Stored plaintext hash before encryption
- Verified after decryption
- Adds second independent integrity check
Each encrypted file is stored as a self-contained binary archive:
| Field | Size | Description |
|---|---|---|
| Magic Header | 8 bytes | File identifier (VAULT002) |
| Timestamp | 19 bytes | Encryption time |
| RSA Key Length | 4 bytes | AES key size indicator |
| Encrypted AES Key | variable | RSA-OAEP ciphertext |
| Nonce | 12 bytes | AES-GCM nonce |
| Filename Length | 4 bytes | Original filename size |
| Filename | variable | UTF-8 encoded |
| SHA-256 Digest | 64 bytes | Integrity hash |
| Ciphertext | variable | Encrypted file data |
- RSA key rotation enforced every 365 days
- Based on NIST SP 800-57 recommendations
- Expired keys block encryption only (decryption remains allowed)
- Key metadata stored in
vault_keyinfo.json
Implements a 3-pass overwrite strategy:
- Overwrite file with random data
- Flush buffers (
fsync) - Remove file from filesystem
- All encryption/decryption operations run in background threads
- GUI remains responsive during heavy computation
- Safe UI updates via Tkinter
after()mechanism
| Package | Purpose |
|---|---|
| cryptography | AES & RSA cryptographic operations |
| tkinter | GUI framework (standard library) |
| tkinterdnd2 | Drag-and-drop support |
- Uses recipient’s public key
- Encrypts file into
.vault - Sends encrypted file only
- Holds private key securely
- Decrypts
.vaultfile locally - Private key never leaves device
This mirrors real-world systems like PGP and TLS.
- Hybrid encryption (AES + RSA)
- Authenticated encryption (GCM mode)
- Password-protected private keys
- Integrity verification (SHA-256 + GCM tag)
- Key lifecycle enforcement
- Secure deletion mechanisms
- RAM-only sensitive data handling