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.
git clone https://github.com/Talha-Yaseen-Hub/Secure-File-Distribution-System.git
cd Secure-File-Distribution-System
g++ *.cpp -o securefile
./securefileFile 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.
| 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 |
| 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 |
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
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
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;
filemanager.cppis 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.
| 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 |
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
| 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 |
|
Send both generated files to the receiver: |
Receiver runs the app and enters:
β Correct password β Not expired β‘οΈ Decrypted successfully β Otherwise β Access denied |
|
Main Menu |
Secure File |
Open Secure File |
π‘ 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.
Prerequisites: a C++ compiler (g++ / MinGW) and a terminal.
πͺ Windows (PowerShell)
g++ *.cpp -o securefile
.\securefile.exeπ§ Linux / π macOS
g++ *.cpp -o securefile
./securefileThis project demonstrates practical implementation of:
- File Encryption
- Authentication
- Access Control
- Time Validation
- Modular Programming
- Secure File Management
| 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 |
- 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
Each module performs a single responsibility, making the code easier to understand, debug, and extend in future versions.
This repository also includes:
- π Project Proposal
- π Complete Project Documentation
- π Presentation Slides
| Course | Information Security |
| Project Type | Info Sec β 4th Semester Project |
| Language | C++ |
| Development Environment | Visual Studio Code |
| Year | 2026 |
Roll No: BITF24M041
π BS Information Technology Β β’Β π« FCIT Β β’Β π Information Security Project (2026)
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.
This project is licensed under the MIT License β see the LICENSE file for full details.