Skip to content

soumya813/FileHider

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FileHider - Secure File Management System

Java JavaFX MySQL Maven License

A robust desktop application for secure file hiding and management with user authentication, email-based OTP verification, and encrypted file storage.

πŸš€ Features

Core Functionality

  • Secure File Hiding: Hide sensitive files with encrypted storage in MySQL database
  • User Authentication: Email-based login with OTP verification
  • File Management: View, hide, and unhide files with detailed metadata
  • Real-time Updates: Dynamic file list updates with progress indicators
  • Cross-platform: JavaFX-based GUI for Windows, macOS, and Linux

Security Features

  • Email OTP Verification: Two-factor authentication via email
  • Encrypted Storage: Files stored as encrypted binary data in database
  • Session Management: Secure user sessions with automatic logout
  • Input Validation: Comprehensive email and file validation

User Interface

  • Modern GUI: Clean, responsive JavaFX interface
  • Intuitive Navigation: Easy-to-use welcome screen and main dashboard
  • File Table View: Sortable table with file details and actions
  • Progress Indicators: Visual feedback for file operations
  • Status Notifications: Real-time status updates and error handling

πŸ—οΈ Architecture

Technology Stack

  • Backend: Java 21 with JavaFX for GUI
  • Database: MySQL 8.0+ with JDBC connectivity
  • Email Service: JavaMail API with Gmail SMTP
  • Build Tool: Apache Maven
  • Architecture Pattern: MVC (Model-View-Controller)

Project Structure

FileHider/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/
β”‚   β”‚   β”‚   β”œβ”€β”€ org/example/filehider/
β”‚   β”‚   β”‚   β”‚   └── FileHiderApp.java          # Main application entry point
β”‚   β”‚   β”‚   β”œβ”€β”€ model/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ User.java                  # User entity model
β”‚   β”‚   β”‚   β”‚   └── Data.java                  # File data model
β”‚   β”‚   β”‚   β”œβ”€β”€ views/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ fx/
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ WelcomeController.java # Welcome screen controller
β”‚   β”‚   β”‚   β”‚   β”‚   └── MainController.java    # Main application controller
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ Welcome.java               # Welcome view
β”‚   β”‚   β”‚   β”‚   └── UserView.java              # User view
β”‚   β”‚   β”‚   β”œβ”€β”€ service/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ SendOTPService.java        # Email OTP service
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ GenerateOTP.java           # OTP generation utility
β”‚   β”‚   β”‚   β”‚   └── UserService.java           # User business logic
β”‚   β”‚   β”‚   β”œβ”€β”€ dao/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ UserDAO.java               # User data access
β”‚   β”‚   β”‚   β”‚   └── DataDAO.java               # File data access
β”‚   β”‚   β”‚   └── db/
β”‚   β”‚   β”‚       └── MyConnection.java          # Database connection
β”‚   β”‚   └── resources/
β”‚   β”‚       β”œβ”€β”€ fxml/
β”‚   β”‚       β”‚   β”œβ”€β”€ welcome.fxml               # Welcome screen layout
β”‚   β”‚       β”‚   └── main.fxml                  # Main application layout
β”‚   β”‚       └── css/
β”‚   β”‚           └── styles.css                 # Application styling
β”‚   └── test/                                  # Test files
β”œβ”€β”€ target/                                    # Compiled classes
β”œβ”€β”€ pom.xml                                    # Maven configuration
β”œβ”€β”€ run-app.bat                               # Windows launcher script
└── README.md                                 # This file

πŸ“‹ Prerequisites

System Requirements

  • Java: OpenJDK 21 or Oracle JDK 21
  • MySQL: MySQL Server 8.0 or higher
  • Maven: Apache Maven 3.6 or higher
  • Email Account: Gmail account for OTP service

Database Setup

  1. Install MySQL Server
  2. Create a new database:
    CREATE DATABASE filehider;
    USE filehider;
  3. Create required tables:
    CREATE TABLE users (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        email VARCHAR(255) UNIQUE NOT NULL
    );
    
    CREATE TABLE data (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        path VARCHAR(500) NOT NULL,
        email VARCHAR(255) NOT NULL,
        bin_data LONGTEXT,
        created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
    );

πŸ› οΈ Installation & Setup

1. Clone the Repository

git clone https://github.com/yourusername/FileHider.git
cd FileHider

2. Configure Database Connection

Edit src/main/java/db/MyConnection.java:

connection = DriverManager.getConnection(
    "jdbc:mysql://localhost:3306/filehider?useSSL=false",
    "your_username",
    "your_password"
);

3. Configure Email Service

Edit src/main/java/service/SendOTPService.java:

String from = "your-email@gmail.com";
// Update the password with your Gmail app password
return new PasswordAuthentication(from, "your-app-password");

4. Build the Project

mvn clean compile

5. Run the Application

Option 1: Using Maven

mvn javafx:run

Option 2: Using Batch File (Windows)

run-app.bat

Option 3: Manual Java Command

java --module-path "path/to/javafx-sdk" \
     --add-modules javafx.controls,javafx.fxml,javafx.base,javafx.graphics \
     -cp "target/classes:path/to/dependencies" \
     org.example.filehider.FileHiderApp

🎯 Usage Guide

First Time Setup

  1. Launch Application: Run the application using one of the methods above
  2. Sign Up: Click "Sign Up" and enter your name and email
  3. Verify Email: Check your email for OTP and enter it in the application
  4. Login: Use your email to log in to the application

File Management

  1. Hide Files: Click "Hide New File" to select and hide files
  2. View Files: All hidden files are displayed in the main table
  3. Unhide Files: Click "Unhide" button next to any file to restore it
  4. Refresh: Use "Refresh" button to update the file list

Security Features

  • OTP Verification: Every login requires email OTP verification
  • Session Management: Automatic logout for security
  • File Encryption: Files are stored encrypted in the database

πŸ”§ Configuration

Database Configuration

  • Host: localhost:3306
  • Database: filehider
  • SSL: Disabled for local development

Email Configuration

  • SMTP Server: smtp.gmail.com
  • Port: 465
  • Security: SSL/TLS enabled
  • Authentication: Gmail app password required

Application Settings

  • Window Size: 800x600 (minimum 600x400)
  • File Size Limit: No explicit limit (limited by database)
  • Supported File Types: All file types

πŸ§ͺ Testing

Unit Tests

mvn test

Manual Testing Checklist

  • User registration with email verification
  • User login with OTP
  • File hiding functionality
  • File unhiding functionality
  • File list refresh
  • Error handling for invalid inputs
  • Database connection stability
  • Email service reliability

🚨 Troubleshooting

Common Issues

Database Connection Error

Error: Connection refused
Solution: Ensure MySQL server is running and credentials are correct

Email OTP Not Received

Error: OTP not sent
Solution: Check Gmail app password and SMTP settings

JavaFX Runtime Error

Error: JavaFX runtime components are missing
Solution: Ensure JavaFX dependencies are properly configured in pom.xml

File Permission Error

Error: Access denied when hiding/unhiding files
Solution: Run application with appropriate file system permissions

Debug Mode

Enable debug logging by setting system properties:

java -Djavafx.debug=true -Dmail.debug=true org.example.filehider.FileHiderApp

πŸ”’ Security Considerations

Data Protection

  • Files are stored as encrypted binary data
  • Database connections use prepared statements
  • User passwords are not stored (OTP-based authentication)

Email Security

  • Uses Gmail app passwords (not regular passwords)
  • SSL/TLS encryption for email transmission
  • OTP expiration (implemented in service layer)

File System Security

  • Original files are deleted after hiding
  • File paths are validated before processing
  • Temporary files are properly cleaned up

πŸ“ˆ Performance Optimization

Database Optimization

  • Indexed email fields for faster queries
  • Prepared statements for query optimization
  • Connection pooling for better resource management

Memory Management

  • Streaming file operations for large files
  • Proper resource cleanup in DAO layer
  • Background task execution for UI responsiveness

🀝 Contributing

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes and test thoroughly
  4. Commit your changes: git commit -m 'Add feature'
  5. Push to the branch: git push origin feature-name
  6. Submit a pull request

Code Style

  • Follow Java naming conventions
  • Use meaningful variable and method names
  • Add comments for complex logic
  • Maintain consistent indentation

Testing Requirements

  • Add unit tests for new features
  • Test database operations
  • Verify email functionality
  • Test UI components

πŸ“„ License

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

πŸ‘₯ Authors

πŸ™ Acknowledgments

  • JavaFX team for the excellent GUI framework
  • MySQL team for the robust database system
  • JavaMail API for email functionality
  • Maven community for build automation

πŸ“ž Support

For support and questions:

  • Create an issue on GitHub

Note: This application is designed for educational and personal use. For production deployment, additional security measures and proper infrastructure setup are recommended.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •