# abhilash1401/securefile architecture

> Architecture diagram of the GitHub repository abhilash1401/securefile, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhilash1401/securefile
- Repository: https://github.com/abhilash1401/securefile

## Overview

SecureFile is a Java file-security tool with a terminal menu and Swing file selection. Its main workflows select and validate a file, then encrypt or decrypt it in chunks, generate a SHA-256 hash, or compare a supplied hash for integrity verification. Encryption and decryption use PBKDF2-derived keys and AES-GCM; operations are recorded in an audit log. The README documents these capabilities, while the sampled source confirms the menu dispatch and core calls. File I/O is local; no external service is shown.

Main entry points: [`Main.java`](https://github.com/abhilash1401/securefile/blob/main/Main.java) (Menu controller), [`FileProcessor.java`](https://github.com/abhilash1401/securefile/blob/main/FileProcessor.java) (Chunk processor), [`FileSelector.java`](https://github.com/abhilash1401/securefile/blob/main/FileSelector.java) (File chooser), [`HashUtils.java`](https://github.com/abhilash1401/securefile/blob/main/HashUtils.java) (SHA-256 hashing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["User workflows"]
  node_main["Menu controller<br/>[Main.java]"]
  node_header["Welcome header<br/>[Header.java]"]
  node_selector["File chooser<br/>[FileSelector.java]"]
  node_validator["File validation<br/>[FileValidator.java]"]
end

subgraph group_security["Encryption security"]
  node_processor["Chunk processor<br/>[FileProcessor.java]"]
  node_key["Key derivation<br/>[KeyGenerator.java]"]
  node_crypto["AES-GCM engine<br/>[CryptoEngine.java]"]
end

subgraph group_integrity["Integrity and audit"]
  node_hash["SHA-256 hashing<br/>[HashUtils.java]"]
  node_audit["Audit logging<br/>[AuditLogger.java]"]
end

node_user(("User"))
node_files["Local files"]
node_logfile["Audit log file"]

node_user -->|"chooses operation"| node_main
node_main -->|"prints header"| node_header
node_main -->|"selects file"| node_selector
node_main -->|"validates file"| node_validator
node_main -->|"encrypts or decrypts"| node_processor
node_main -->|"calculates hash"| node_hash
node_main -->|"records operation"| node_audit
node_selector -->|"selects from"| node_files
node_processor -->|"derives key"| node_key
node_processor -->|"creates cipher"| node_crypto
node_processor -->|"reads and writes"| node_files
node_hash -->|"reads file"| node_files
node_audit -->|"appends entries"| node_logfile

click node_main "https://github.com/abhilash1401/securefile/blob/main/Main.java"
click node_header "https://github.com/abhilash1401/securefile/blob/main/Header.java"
click node_selector "https://github.com/abhilash1401/securefile/blob/main/FileSelector.java"
click node_validator "https://github.com/abhilash1401/securefile/blob/main/FileValidator.java"
click node_processor "https://github.com/abhilash1401/securefile/blob/main/FileProcessor.java"
click node_key "https://github.com/abhilash1401/securefile/blob/main/KeyGenerator.java"
click node_crypto "https://github.com/abhilash1401/securefile/blob/main/CryptoEngine.java"
click node_hash "https://github.com/abhilash1401/securefile/blob/main/HashUtils.java"
click node_audit "https://github.com/abhilash1401/securefile/blob/main/AuditLogger.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_header,node_selector,node_validator,node_user toneBlue
class node_processor,node_key,node_crypto toneAmber
class node_hash,node_audit toneMint
class node_files,node_logfile toneIndigo
```

## Components

### User workflows

- [Menu controller](https://github.com/abhilash1401/securefile/blob/main/Main.java): `Main.java`
- [Welcome header](https://github.com/abhilash1401/securefile/blob/main/Header.java): `Header.java`
- [File chooser](https://github.com/abhilash1401/securefile/blob/main/FileSelector.java): `FileSelector.java`
- [File validation](https://github.com/abhilash1401/securefile/blob/main/FileValidator.java): `FileValidator.java`

### Encryption security

- [Chunk processor](https://github.com/abhilash1401/securefile/blob/main/FileProcessor.java): `FileProcessor.java`
- [Key derivation](https://github.com/abhilash1401/securefile/blob/main/KeyGenerator.java): `KeyGenerator.java`
- [AES-GCM engine](https://github.com/abhilash1401/securefile/blob/main/CryptoEngine.java): `CryptoEngine.java`

### Integrity and audit

- [SHA-256 hashing](https://github.com/abhilash1401/securefile/blob/main/HashUtils.java): `HashUtils.java`
- [Audit logging](https://github.com/abhilash1401/securefile/blob/main/AuditLogger.java): `AuditLogger.java`

### Other components

- **User**
- **Local files**
- **Audit log file**

## Connections

- User → Menu controller: chooses operation (evidence: `README.md`)
- Menu controller → Welcome header: prints header (evidence: `Main.java`)
- Menu controller → File chooser: selects file (evidence: `Main.java`)
- Menu controller → File validation: validates file (evidence: `Main.java`)
- Menu controller → Chunk processor: encrypts or decrypts (evidence: `Main.java`)
- Menu controller → SHA-256 hashing: calculates hash (evidence: `Main.java`)
- Menu controller → Audit logging: records operation (evidence: `Main.java`)
- File chooser → Local files: selects from (evidence: `FileSelector.java`)
- Chunk processor → Key derivation: derives key (evidence: `FileProcessor.java`)
- Chunk processor → AES-GCM engine: creates cipher (evidence: `FileProcessor.java`)
- Chunk processor → Local files: reads and writes (evidence: `FileProcessor.java`)
- SHA-256 hashing → Local files: reads file (evidence: `HashUtils.java`)
- Audit logging → Audit log file: appends entries (evidence: `AuditLogger.java`)
