# bambadiagne/cryptojava architecture

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

- Interactive diagram: https://gitdiagram.com/bambadiagne/cryptojava
- Repository: https://github.com/bambadiagne/cryptojava

## Overview

##### Main Components
- User Interface (UI): The project uses Java Swing for the frontend. In the file tree, this is represented by the “ui” package (with forms and corresponding Java classes for Connexion, Home, Inscription).
- Business Logic / Core Application: This includes the “main” package that contains the Main.java entry point and likely coordinates the different functionalities.
- Cryptography Module: Organized under the “crypto” package. Within it, separate folders cater to ciphers (Symmetric and Asymmetric), key generation (genkey), and digital signature (signature).
- Database Access / Account Management: Housed in the “bdd” directory, it includes classes like ConnexionDB, User, and UserQueries to manage the underlying MySQL database that holds account details.
- Utility Functions: Located under the “utils” package (e.g., for SHA256 hashing and other helper methods).

##### Relationships and Interactions
- The UI layer interacts directly with the business logic layer. For example, when a user creates an account or requests encryption, the UI components invoke methods in the corresponding business logic.
- The business logic, in turn, calls cryptography routines (key generation, encryption/decryption, signature) as needed based on user actions.
- For account creation and login functionality, the application communicates with the database via the classes provided in the “bdd” folder.
- The utility functions are shared resources that support various operations across modules.

##### Architectural Patterns and Design Principles
- Modular Design: Each significant functionality (cryptography, database, UI) is encapsulated in its own package, reflecting modular architecture.
- Separation of Concerns: The code structure indicates separation between UI, cryptographic operations, and database operations.
- MVC-Like Separation (implicitly): While not a strict MVC framework, the organization of “ui” versus the “core” logic (crypto, bdd, utils) can be considered under a separation of presentation and logic.
- Reusability: Utility classes and a clear division of cryptographic functions (key generation, encryption/decryption, signatures) promote reuse.

##### Final Recommendations
- Configuration elements like the database connector details, which are crucial during integration.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User Interface"
        UI("User Interface"):::frontend
        UI1("Connexion"):::frontend
        UI2("Home"):::frontend
        UI3("Inscription"):::frontend
        UI --> UI1
        UI --> UI2
        UI --> UI3
    end

    subgraph "Business Logic"
        BL("Main Application"):::logic
    end

    subgraph "Cryptography Modules"
        CR1("Symmetric & Asymmetric Ciphers"):::crypto
        CR2("Key Generation"):::crypto
        CR3("Digital Signature"):::crypto
    end

    subgraph "Database Access"
        DB("Database Access"):::db
    end

    subgraph "Utility Functions"
        UT("Utility Functions"):::utils
    end

    UI -->|"triggers"| BL
    BL -->|"invokes"| CR1
    BL -->|"invokes"| CR2
    BL -->|"invokes"| CR3
    BL -->|"queries"| DB
    BL -->|"uses"| UT
    CR1 -->|"utilizes"| UT
    CR2 -->|"utilizes"| UT
    CR3 -->|"utilizes"| UT

    click UI "https://github.com/bambadiagne/cryptojava/tree/master/src/ahmadouBambaDiagne/ui"
    click BL "https://github.com/bambadiagne/cryptojava/blob/master/src/ahmadouBambaDiagne/main/Main.java"
    click CR1 "https://github.com/bambadiagne/cryptojava/tree/master/src/ahmadouBambaDiagne/crypto/ciphers"
    click CR2 "https://github.com/bambadiagne/cryptojava/tree/master/src/ahmadouBambaDiagne/crypto/genkey"
    click CR3 "https://github.com/bambadiagne/cryptojava/blob/master/src/ahmadouBambaDiagne/crypto/signature/CryptoSignature.java"
    click DB "https://github.com/bambadiagne/cryptojava/tree/master/src/ahmadouBambaDiagne/bdd"
    click UT "https://github.com/bambadiagne/cryptojava/tree/master/src/ahmadouBambaDiagne/utils"

    classDef frontend fill:#f7b2ad,stroke:#333,stroke-width:2px;
    classDef logic fill:#b2dff7,stroke:#333,stroke-width:2px;
    classDef crypto fill:#dff7b2,stroke:#333,stroke-width:2px;
    classDef db fill:#f7f2b2,stroke:#333,stroke-width:2px;
    classDef utils fill:#e0b2f7,stroke:#333,stroke-width:2px;
```
