A Flask-based secure document management system demonstrating enterprise-grade security practices including hybrid encryption (AES + RSA), digital signatures, multi-factor authentication, and role-based access control.
- Hybrid Encryption: AES-256 (symmetric) + RSA-2048 (asymmetric)
- Digital Signatures: RSA-PSS for document authenticity verification
- Multi-Factor Authentication: Password + Time-based OTP
- Role-Based Access Control: Three-tier permission system
- Security Auditing: Complete access logging and audit trails
- Input Validation: Protection against injection and malicious uploads
- Rate Limiting: Brute force attack prevention
- Cryptography: Python
cryptographylibrary for industry-standard encryption - Password Hashing: PBKDF2-SHA256 with automatic salting
- Session Management: Secure Flask sessions with cryptographic signing
- Database Security: Encrypted data at rest, secure foreign key relationships
- Configuration Management: Environment-based secrets (never hardcoded)
-
Clone and navigate to the repository
cd SecureLocker -
Create virtual environment
python -m venv venv venv\Scripts\activate # Windows
-
Install dependencies
pip install -r requirements.txt
-
Generate secrets
python generate_secrets.py
This creates a
.envfile with secure random secrets. -
Initialize database
python init_db.py
-
Run the application
python app.py
Access at
http://localhost:5000
- Admin: username
admin, passwordadmin123 - Access codes: Check your
.envfile after runninggenerate_secrets.py
| Role | Upload | View Own | View Public | View All | Download | Audit Logs |
|---|---|---|---|---|---|---|
| Student | ✅ | ✅ | ❌ | ❌ | Own files | ❌ |
| Verifier | ❌ | ❌ | ✅ | ❌ | Public files | ❌ |
| Admin | ❌ | ❌ | ❌ | ✅ | All files | ✅ |
- Upload: Student uploads certificate → AES-256 encryption → RSA-2048 key encryption → Digital signature generation
- Storage: Encrypted data + encrypted key + signature stored in database
- Verification: Verifier accesses public certificate → Decryption → Signature verification → VALID/TAMPERED status
- Auditing: All actions logged with timestamp, user, and action details
SecureLocker/
├── templates/ # HTML templates
│ ├── dashboard_*.html # Role-specific dashboards
│ ├── login.html # Authentication pages
│ └── register.html # Real-time password validation
├── app.py # Main Flask application
├── models.py # Database models (User, Certificate, AccessLog)
├── config.py # Configuration management
├── security.py # Security utilities & validation
├── init_db.py # Database initialization
├── generate_secrets.py # Secret generation utility
├── requirements.txt # Python dependencies
├── .env.example # Configuration template
└── SECURITY.md # Security documentation
- Files encrypted with AES-256-CBC (fast for large files)
- AES keys encrypted with RSA-2048-OAEP (secure key management)
- Initialization vectors (IV) for randomization
- PKCS7 padding for block alignment
- SHA-256 hashing of file content
- RSA-PSS signature scheme
- Public key verification
- Tamper detection on every access
- Password hashing with PBKDF2-SHA256
- Automatic salt generation
- 6-digit OTP with 5-minute expiration
- Maximum 3 OTP attempts before re-login required
- Account lockout after 5 failed login attempts
- Login: 10 attempts/minute
- OTP: 5 attempts/minute
- Failed logins: 15-minute lockout after 5 attempts
- Backend: Flask 2.3.3, SQLAlchemy 3.0.5
- Security: cryptography 41.0.7, Flask-Login 0.6.3, Flask-Limiter 3.5.0
- Database: SQLite (file-based, portable)
- Authentication: Custom MFA with OTP
- Frontend: Bootstrap 5, Vanilla JavaScript (real-time validation)
- app.py: Routes, authentication logic, file upload/download handlers
- models.py: Database schema with security considerations (indexes, cascades)
- security.py: Reusable security functions (validation, rate limiting, crypto helpers)
- config.py: Environment-based configuration (12-factor app pattern)
- init_db.py: Database setup with proper schema initialization
🔐 Key Management: The RSA private key is critical - without it, encrypted data cannot be recovered. The key is encrypted with a passphrase from your .env file.
📊 Database: Uses SQLite for simplicity. All encryption happens before storage, so even raw database access reveals only encrypted data.
- SECURITY.md: Detailed security features, threat model, and best practices
- Code Comments: Extensive inline documentation explaining security decisions
- .env.example: Configuration template with explanations
Educational project demonstrating cybersecurity concepts.
Project Purpose: Academic demonstration of secure application development practices and cryptographic implementation.
Author: Pranathi N
Repository: github.com/Pranathi-N-47/SecureLocker