A comprehensive client-server Java application that provides secure file sharing with end-to-end encryption, self-destructing files, honeypot security, and file integrity verification.
- AES-256 Encryption: All files are encrypted using Advanced Encryption Standard
- RSA Key Exchange: 2048-bit RSA encryption for secure key distribution
- SHA-256 Hashing: File integrity verification using cryptographic hashes
- End-to-End Encryption: Files remain encrypted in transit and at rest
-
Self-Destructing Files
- Time-based expiration (files auto-delete after set hours)
- Download-count-based deletion (limit number of downloads)
- Automatic cleanup of expired files
-
Honeypot Security
- Decoy files to trap unauthorized users
- Automatic logging of suspicious activity
- IP tracking for security analysis
-
File Integrity Verification
- SHA-256 hash generation on upload
- Automatic verification before download
- Tamper detection and alerts
-
Secure Authentication
- Password hashing using SHA-256
- RSA key pair generation for each user
- Session management and activity logging
- Java Development Kit (JDK) 11 or higher
- SQLite JDBC Driver (included in lib/)
cd SecureFileSharing/lib
wget https://repo1.maven.org/maven2/org/xerial/sqlite-jdbc/3.44.1.0/sqlite-jdbc-3.44.1.0.jarOr manually download from: https://github.com/xerial/sqlite-jdbc/releases
# Navigate to project directory
cd SecureFileSharing
# Compile all source files
javac -d bin -cp "lib/*" src/common/*.java src/database/*.java src/server/*.java src/client/*.javamkdir -p secure_storage
mkdir -p downloads# From the SecureFileSharing directory
java -cp "bin:lib/*" server.ServerThe server will start on port 5555 and display:
═══════════════════════════════════════════════════
SECURE FILE SHARING SERVER
═══════════════════════════════════════════════════
Server started on port: 5555
Security features enabled:
✓ AES-256 Encryption
✓ RSA Key Exchange
✓ File Integrity Verification (SHA-256)
✓ Self-Destructing Files
✓ Honeypot Security
═══════════════════════════════════════════════════
Open a new terminal:
# From the SecureFileSharing directory
java -cp "bin:lib/*" client.Client- Choose option
1from the login menu - Enter desired username and password
- IMPORTANT: Save your private key securely! You'll need it to decrypt your files
- Optionally save the private key to a file
- Choose option
2from the login menu - Enter username and password
- Provide your private key (paste it or provide file path ending in .key)
- From main menu, choose option
1 - Enter the full path to the file you want to upload
- Set expiry time in hours (0 for no expiry)
- Set max download count (-1 for unlimited)
- File will be encrypted and uploaded
- From main menu, choose option
2 - Enter the file ID (get from List Files)
- Specify download directory
- File will be decrypted and saved locally
- From main menu, choose option
3 - View all your uploaded files with:
- File ID
- File name
- Download count (current/max)
- Expiry time
- From main menu, choose option
4 - Enter file ID to delete
- Confirm deletion
- File will be permanently removed
SecureFileSharing/
├── src/
│ ├── common/
│ │ ├── User.java # User data model
│ │ ├── FileMetadata.java # File metadata model
│ │ └── Protocol.java # Communication protocol
│ ├── database/
│ │ └── DatabaseManager.java # Database operations
│ ├── server/
│ │ ├── Server.java # Main server class
│ │ ├── ClientHandler.java # Client connection handler
│ │ ├── EncryptionModule.java # Encryption/decryption operations
│ │ ├── FileManager.java # File upload/download management
│ │ └── HoneypotModule.java # Security monitoring
│ └── client/
│ └── Client.java # Client application
├── lib/
│ └── sqlite-jdbc-*.jar # SQLite JDBC driver
├── secure_storage/ # Encrypted file storage
├── downloads/ # Downloaded files location
└── secure_file_sharing.db # SQLite database (auto-created)
- user_id (Primary Key)
- username (Unique)
- password_hash
- public_key
- file_id (Primary Key)
- owner_id (Foreign Key)
- file_name
- encrypted_path
- encrypted_key
- upload_time
- expiry_time
- max_downloads
- download_count
- file_hash
- log_id (Primary Key)
- user_id (Foreign Key)
- activity
- timestamp
- ip_address
- share_id (Primary Key)
- file_id (Foreign Key)
- shared_with_user_id (Foreign Key)
Upload Process:
- User selects file
- System generates random AES-256 key
- File encrypted with AES key
- AES key encrypted with user's RSA public key
- SHA-256 hash generated for integrity
- Encrypted file stored on server
- Metadata saved to database
Download Process:
- Server verifies user authorization
- Checks file expiry and download limits
- Verifies file integrity using stored hash
- Returns encrypted file + encrypted AES key
- Client decrypts AES key using RSA private key
- Client decrypts file using AES key
- Server checks expiry time before every download
- Tracks download count per file
- Automatically deletes files that meet deletion criteria
- Hourly cleanup task removes expired files
- Generates fake decoy files
- Monitors failed login attempts
- Logs unauthorized access attempts
- Triggers when suspicious behavior detected
Edit Server.java:
private static final int PORT = 5555; // Change to desired portEdit Server.java:
private static final int THREAD_POOL_SIZE = 10; // Increase for more concurrent clientsEdit EncryptionModule.java:
private static final int AES_KEY_SIZE = 256; // 128, 192, or 256
private static final int RSA_KEY_SIZE = 2048; // 1024, 2048, or 4096- Upload a file with 1-hour expiry
- Wait 1 hour
- Try to download - should get "FILE_EXPIRED" error
- Upload a file with max 2 downloads
- Download twice successfully
- Third download attempt should fail
- Make 3+ failed login attempts
- Successfully login
- List files - may see decoy files
Make sure SQLite JDBC driver is in the lib/ directory and included in classpath.
Ensure the server is running before starting the client.
File may have expired or reached download limit.
Verify you're using the correct private key for your account.
All security events are logged in the database:
- User registrations
- Login attempts (success/failure)
- File uploads/downloads
- Unauthorized access attempts
- Honeypot triggers
Query logs:
SELECT * FROM security_logs ORDER BY timestamp DESC LIMIT 20;- Requires server to be running continuously
- Large files may take longer to encrypt/decrypt
- Private key must be stored securely by user
- No built-in cloud storage integration
- Single server instance (no load balancing)
- Two-Factor Authentication (2FA)
- Web-based GUI using JavaFX
- Cloud storage integration (AWS S3, Google Cloud)
- Mobile application support
- Blockchain-based file tracking
- Advanced access control (read-only, time-limited)
- File versioning
- Encrypted chat functionality
- Multi-server clustering
- REST API support
This project is created for educational purposes. Use at your own risk.
This is an academic project. For improvements:
- Test thoroughly
- Follow existing code structure
- Document all changes
- Ensure security features remain intact
- Never share your private key
- Store private keys in a secure location
- Use strong passwords
- Regular backups recommended
- This is an educational project - additional security auditing recommended for production use
For issues or questions:
- Check the troubleshooting section
- Review the database logs
- Verify all prerequisites are met
- Ensure proper file permissions
Built with ❤️ for secure file sharing