Skip to content

About

A desktop-based Information Security project developed in C++ that demonstrates secure file sharing using encryption, password-based authentication, and time-limited access control. The system ensures that only authorized users can access shared files before the specified expiry time.

Resources

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

35 Commits

Folders and files

Repository files navigation

Typing SVG




A desktop-based Information Security project that demonstrates secure file sharing using encryption, password-based authentication, and time-limited access control β€” ensuring only authorized users can open a shared file, and only before it expires.


⚑ Quick Start

git clone https://github.com/Talha-Yaseen-Hub/Secure-File-Distribution-System.git
cd Secure-File-Distribution-System
g++ *.cpp -o securefile
./securefile

πŸ“‘ Table of Contents


πŸ“– About the Project

File sharing has become an essential part of modern communication, but traditional methods often fail to provide proper security after a file has been distributed. Once shared, the sender usually loses all control over who accesses the file and for how long.

This project solves that problem with a Secure File Distribution System β€” it protects files through encryption and restricts access using password verification combined with an automatically enforced expiry timer.

Developed as part of the Information Security course, this project demonstrates fundamental security concepts β€” confidentiality, authentication, and access control β€” in a practical, hands-on environment.


🎯 Project Objectives

Objective
πŸ” Protect files using encryption
πŸ”‘ Restrict access through password authentication
⏳ Implement time-limited file access
πŸ“ Enable secure confidential file sharing
πŸ“ Maintain a complete access log
πŸ’» Demonstrate core Information Security principles in practice

✨ Key Features

Feature Description
πŸ”’ File Encryption Encrypts files with XOR-based encryption before they're shared
πŸ”“ File Decryption Restores original content only after successful authentication
πŸ”‘ Password Protection Access is locked behind a sender-defined password
⏰ Expiry Validation Every access attempt is checked against a hard expiry timestamp
πŸ“‚ Metadata Generation Password + expiry data stored in a dedicated .meta file
πŸ“‹ Access Logging Every attempt β€” successful or failed β€” is written to access_log.txt
⚠️ Input Validation Blocks invalid file names, empty passwords, and malformed expiry values
❌ Invalid Access Detection Flags and rejects incorrect password attempts
πŸ—‘οΈ Auto-Deletion Expired files are automatically removed, closing the access window for good
🧩 Modular Architecture Each responsibility lives in its own isolated module
πŸ’» Console Interface Lightweight, dependency-free, runs anywhere g++ does

🧠 System Workflow

flowchart TD
    A([πŸ‘€ Sender]) --> B[πŸ“ Select Original File]
    B --> C[πŸ”‘ Enter Password & Expiry Time]
    C --> D[πŸ” Encrypt File β€” XOR]
    D --> E[πŸ“ Generate Metadata .meta]
    E --> F[πŸ“€ Share .enc + .meta Files]
    F --> G([πŸ‘€ Receiver])
    G --> H[πŸ”‘ Enter Password]
    H --> I{βœ… Password Correct?}
    I -- No --> J[❌ Access Denied]
    I -- Yes --> K{⏳ Expired?}
    K -- Yes --> L[πŸ—‘οΈ Auto-Delete File]
    L --> J
    K -- No --> M[πŸ”“ Decrypt & View File]

    style A fill:#1E3C72,color:#fff,stroke:#FFD700,stroke-width:2px
    style G fill:#1E3C72,color:#fff,stroke:#FFD700,stroke-width:2px
    style M fill:#2ECC71,color:#fff,stroke:#1E3C72
    style J fill:#E74C3C,color:#fff,stroke:#1E3C72
    style L fill:#E74C3C,color:#fff,stroke:#1E3C72
Loading

πŸ”„ Sequence Diagram

sequenceDiagram
    actor Sender
    participant System as πŸ” Secure File System
    actor Receiver

    Sender->>System: Select file + set password + expiry
    System->>System: Encrypt file (XOR)
    System->>System: Generate metadata (.meta)
    System-->>Sender: report.txt.enc + report.txt.meta
    Sender->>Receiver: Share .enc + .meta files

    Receiver->>System: Enter password
    System->>System: Validate password

    alt Password Invalid
        System-->>Receiver: ❌ Access Denied
    else Password Valid
        System->>System: Check expiry timestamp
        alt Expired
            System->>System: Delete file automatically
            System-->>Receiver: ❌ File Expired
        else Not Expired
            System->>System: Decrypt file
            System-->>Receiver: βœ… Decrypted Content
        end
    end
Loading

🧩 Module Architecture

graph TD
    Main[["πŸš€ main.cpp"]] --> Menu["🧭 menu.cpp"]
    Menu --> FM["πŸ—‚οΈ filemanager.cpp"]
    FM --> ENC["πŸ” encryption.cpp"]
    FM --> AC["πŸ”‘ accesscontrol.cpp"]
    FM --> VAL["βœ… validator.cpp"]
    AC --> META[("πŸ“ .meta files")]
    ENC --> ENCFILE[("πŸ”’ .enc files")]
    AC --> LOG[("πŸ“‹ access_log.txt")]

    classDef core fill:#1E3C72,color:#fff,stroke:#FFD700,stroke-width:1px;
    classDef data fill:#2A5298,color:#fff,stroke:#FFD700,stroke-width:1px,stroke-dasharray: 3 3;
    class Main,Menu,FM,ENC,AC,VAL core;
    class META,ENCFILE,LOG data;
Loading

filemanager.cpp is the central controller β€” it's the only module that talks directly to encryption, access control, and validation, keeping every other module decoupled from the rest.


πŸ› οΈ Tech Stack

Technology Purpose
C++ Application development
File Handling Reading/writing encrypted and metadata files
XOR Encryption Data protection (educational purpose)
Time Library Expiry timestamp validation
Modular Programming Code organization and separation of concerns
Visual Studio Code Development environment
MinGW g++ Compilation

πŸ“‚ Project Structure

SecureFileDistributionSystem/
β”‚
β”œβ”€β”€ πŸ“ Source
β”‚   β”œβ”€β”€ main.cpp
β”‚   β”œβ”€β”€ menu.cpp
β”‚   β”œβ”€β”€ filemanager.cpp
β”‚   β”œβ”€β”€ encryption.cpp
β”‚   β”œβ”€β”€ accesscontrol.cpp
β”‚   └── validator.cpp
β”‚
β”œβ”€β”€ πŸ“ Header Files
β”‚   β”œβ”€β”€ menu.h
β”‚   β”œβ”€β”€ filemanager.h
β”‚   β”œβ”€β”€ encryption.h
β”‚   β”œβ”€β”€ accesscontrol.h
β”‚   └── validator.h
β”‚
β”œβ”€β”€ πŸ“ Sample Files
β”‚   β”œβ”€β”€ report.txt
β”‚   β”œβ”€β”€ report.txt.enc
β”‚   β”œβ”€β”€ report.txt.meta
β”‚   └── access_log.txt
β”‚
β”œβ”€β”€ πŸ“ Documentation
β”‚   β”œβ”€β”€ Project Proposal.pdf
β”‚   β”œβ”€β”€ Project Documentation.pdf
β”‚   └── Presentation.pptx
β”‚
└── README.md

πŸ“„ Source Code Overview

File Type Responsibility
main.cpp Source Entry point. Controls program flow, initializes the system, calls menu functions
menu.cpp Source Displays the console menu and handles user selections
menu.h Header Function declarations for the menu module
filemanager.cpp Source Central controller β€” coordinates encryption, metadata creation, password verification, decryption, and logging
filemanager.h Header Declares the file management functions used throughout the app
encryption.cpp Source Performs XOR encryption/decryption and handles binary file operations
encryption.h Header Prototypes for encryption/decryption operations
accesscontrol.cpp Source Manages password authentication, expiry validation, metadata, and auto-deletion
accesscontrol.h Header Declares access-control-related functions
validator.cpp Source Validates user input, file existence, and expiry values
validator.h Header Declarations for validation functions
report.txt Sample Demonstration file used to test encryption/decryption
report.txt.enc Generated Encrypted version of the original file, shared with the receiver
report.txt.meta Generated Stores metadata β€” password and expiry timestamp
access_log.txt Generated Records successful and failed access attempts

πŸ”„ Project Execution

1️⃣ Secure File

  • Enter file name
  • Enter password
  • Enter expiry time
  • File is encrypted
  • Metadata is generated
report.txt.enc
report.txt.meta

2️⃣ Share Files

Send both generated files to the receiver:

report.txt.enc
report.txt.meta

3️⃣ Open Secure File

Receiver runs the app and enters:

  • File name
  • Password

βœ” Correct password βœ” Not expired ➑️ Decrypted successfully

❌ Otherwise β†’ Access denied


πŸ” Security Concepts Demonstrated


πŸ“· Sample Output

Main Menu

=============================
 Secure File System
=============================
1 Secure File
2 Open Secure File
3 Exit

Secure File

Enter file name:
report.txt

Set password:
1234

Enter expiry time:
5

File secured successfully.

Open Secure File

Enter file name:
report.txt

Enter password:
1234

File Content:
Information Security Notes...

πŸ’‘ Tip: Replace these console captures with real terminal screenshots or a short GIF demo β€” it's one of the highest-impact upgrades you can make to this README.


πŸš€ Getting Started

Prerequisites: a C++ compiler (g++ / MinGW) and a terminal.

πŸͺŸ Windows (PowerShell)
g++ *.cpp -o securefile
.\securefile.exe
🐧 Linux / 🍎 macOS
g++ *.cpp -o securefile
./securefile

πŸ“š Learning Outcomes

This project demonstrates practical implementation of:

  • File Encryption
  • Authentication
  • Access Control
  • Time Validation
  • Modular Programming
  • Secure File Management

⚠️ Limitations

Limitation Note
XOR encryption Used for educational purposes β€” not cryptographically strong like AES
Local desktop only No network-based file transfer
Console interface No GUI
Prototype scope Built for learning, not production deployment

πŸš€ Future Enhancements

  • AES-256 Encryption
  • PBKDF2 password-based key derivation
  • SHA-256 password hashing
  • Graphical User Interface (GUI)
  • Secure network-based file sharing
  • Database integration
  • Digital signatures
  • Multi-user authentication
  • Cloud storage support

🧩 Design Principles

Each module performs a single responsibility, making the code easier to understand, debug, and extend in future versions.


πŸ“– Documentation

This repository also includes:

  • πŸ“„ Project Proposal
  • πŸ“˜ Complete Project Documentation
  • πŸ“Š Presentation Slides

πŸŽ“ Academic Information

Course Information Security
Project Type Info Sec β€” 4th Semester Project
Language C++
Development Environment Visual Studio Code
Year 2026

πŸ‘¨β€πŸ’» Author

Talha Yaseen

Roll No: BITF24M041

πŸŽ“ BS Information Technology Β β€’Β  🏫 FCIT Β β€’Β  πŸ“š Information Security Project (2026)


⭐ Support This Project

If this project helped you understand file security concepts, consider giving it a star β€” it genuinely helps and motivates further educational builds like this one.


πŸ“œ MIT License

This project is licensed under the MIT License β€” see the LICENSE file for full details.


⬆ Back to Top



πŸ” Happy Learning!

"Security is a continuous process, not a one-time solution."


About

A desktop-based Information Security project developed in C++ that demonstrates secure file sharing using encryption, password-based authentication, and time-limited access control. The system ensures that only authorized users can access shared files before the specified expiry time.

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages