# scrolldynasty/data_encryption architecture

> Architecture diagram of the GitHub repository scrolldynasty/data_encryption, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scrolldynasty/data_encryption
- Repository: https://github.com/scrolldynasty/data_encryption

## Overview

##### Main Components

A. User Interface Layer:
- Tkinter-based GUI components
- Main window with encryption/decryption tabs
- Dialog components for file selection and password input

B. Core Encryption Layer:
- Supported encryption algorithms (Fernet, AES, RSA)
- Key management system
- Encryption/decryption workflow

C. File Handling Layer:
- Demonstrate file processing components
- Chunked file handling for large files
- Metadata preservation system

D. Utility Layer:
- Configuration management
- Logging system
- Validation components

##### Component Relationships

**[User Interface Layer]**
- ↕
**[Core Encryption Layer]**
- ↕
**[File Handling Layer]**
- ↕
**[Utility Layer]**

##### Detailed Component Breakdown

User Interface Layer:
- To 'dialogs.py' for user interactions
- 'styles.py' for UI styling

Core Encryption Layer:
- To 'algorithms.py' showing supported encryption methods
- Link to 'key_manager.py' for key handling

File Handling Layer:
- 'file_handler.py' as the main component
- To 'chunked_file_handler.py' for large file processing

Utility Layer:
- 'config.py' for configuration management
- 'logger.py' for logging system
- 'validators.py' for input validation

##### Important Workflows to Highlight

A. Encryption Flow:
**GUI → File Selection → Password Validation →**
**Key Generation → Encryption → File Writing → Logging**

B. Decryption Flow:
**GUI → File Selection → Password Validation →**
**Key Retrieval → Decryption → File Writing → Logging**

##### Additional Elements

- Notes about the chunked processing for large files
- Configuration file interactions
- Logging points throughout the system

##### Technical Details

- Python 3.8+ requirement
- Tkinter for GUI
- Cryptography library integration
- CFFI interface points
- File system interactions

##### Future Extensions

- RSA encryption module
- Drag-and-drop interface
- Multi-threading support
- Cloud storage integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef crypto fill:#e74c3c,stroke:#c0392b,color:white
    classDef file fill:#2ecc71,stroke:#27ae60,color:white
    classDef util fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef future fill:none,stroke:#34495e,stroke-dasharray: 5 5
    
    %% User Interface Layer
    subgraph UI["User Interface Layer"]
        GUI["Main Window Controller"]
        Dialogs["Dialog Components"]
        Styles["UI Styling"]
    end
    
    %% Core Encryption Layer
    subgraph Crypto["Core Encryption Layer"]
        Encryptor["Main Encryption Component"]
        Algorithms["Encryption Algorithms"]
        KeyManager["Key Management System"]
    end
    
    %% File Handling Layer
    subgraph Files["File Handling Layer"]
        FileHandler["Main File Handler"]
        ChunkedHandler["Chunked File Handler"]
    end
    
    %% Utility Layer
    subgraph Utils["Utility Layer"]
        Config["Configuration Management"]
        Logger["Logging System"]
        Validators["Validation Components"]
    end
    
    %% Future Extensions
    subgraph Future["Planned Features"]
        RSA["RSA Encryption"]:::future
        DragDrop["Drag-and-Drop Interface"]:::future
        MultiThread["Multi-Threading Support"]:::future
        CloudStorage["Cloud Storage Integration"]:::future
    end
    
    %% Relationships
    GUI --> Dialogs
    GUI --> Styles
    GUI --> Encryptor
    Dialogs --> Validators
    
    Encryptor --> Algorithms
    Encryptor --> KeyManager
    Encryptor --> FileHandler
    
    FileHandler --> ChunkedHandler
    FileHandler --> Logger
    
    ChunkedHandler --> Logger
    
    Validators --> Config
    Validators --> Logger
    
    %% Apply Classes
    class GUI,Dialogs,Styles ui
    class Encryptor,Algorithms,KeyManager crypto
    class FileHandler,ChunkedHandler file
    class Config,Logger,Validators util
    
    %% Click Events
    click GUI "https://github.com/scrollDynasty/data_encryption/blob/master/src/interface/gui.py"
    click Dialogs "https://github.com/scrollDynasty/data_encryption/blob/master/src/interface/dialogs.py"
    click Styles "https://github.com/scrollDynasty/data_encryption/blob/master/src/interface/styles.py"
    click Encryptor "https://github.com/scrollDynasty/data_encryption/blob/master/src/crypto/encryptor.py"
    click Algorithms "https://github.com/scrollDynasty/data_encryption/blob/master/src/crypto/algorithms.py"
    click KeyManager "https://github.com/scrollDynasty/data_encryption/blob/master/src/crypto/key_manager.py"
    click FileHandler "https://github.com/scrollDynasty/data_encryption/blob/master/src/utils/file_handler.py"
    click ChunkedHandler "https://github.com/scrollDynasty/data_encryption/blob/master/src/utils/chunked_file_handler.py"
    click Config "https://github.com/scrollDynasty/data_encryption/blob/master/src/utils/config.py"
    click Logger "https://github.com/scrollDynasty/data_encryption/blob/master/src/utils/logger.py"
    click Validators "https://github.com/scrollDynasty/data_encryption/blob/master/src/utils/validators.py"
    
    %% Legend
    subgraph Legend
        UI_Legend["UI Component"]:::ui
        Crypto_Legend["Crypto Component"]:::crypto
        File_Legend["File Component"]:::file
        Util_Legend["Utility Component"]:::util
        Future_Legend["Future Feature"]:::future
    end
```
